Video encoding method using offset adjustments according to pixel classification and apparatus therefor, video decoding method and apparatus therefor

ABSTRACT

A video encoding method and apparatus and video decoding method and apparatus generate a restored image having a minimum error with respect to an original image based on offset merge information indicating whether offset parameters of a current block and at least one neighboring block from among blocks of video are identical.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. application Ser. No.15/221,979 filed on Jul. 28, 2016, in the U.S. Patent and TrademarkOffice, which is a continuation of U.S. application Ser. No. 14/620,413filed on Feb. 12, 2015, in the U.S. Patent and Trademark Office, nowU.S. Pat. No. 9,438,922, issued Sep. 6, 2016, which is a continuation ofU.S. application Ser. No. 14/130,011 filed on Mar. 7, 2014, in the U.S.Patent and Trademark Office, now U.S. Pat. No. 9,426,482, issued Aug.23, 2016 which is a National Stage application under 35 U.S.C. § 371 ofInternational Application No. PCT/KR2012/005086, filed on Jun. 27, 2012,and claims the benefit of U.S. Provisional Application No. 61/502,018,filed on Jun. 28, 2011, in the U.S. Patent and Trademark Office, thedisclosures of which are incorporated herein by reference in theirentireties.

1. FIELD

Methods and apparatuses consistent with exemplary embodiments relate tovideo encoding and decoding, and more particularly to video encoding anddecoding to minimize an error between an original image and a restoredimage.

2. DESCRIPTION OF RELATED ART

As hardware for reproducing and storing high resolution or high qualityvideo content is being developed, there is a need for a video codec foreffectively encoding or decoding the high resolution or high qualityvideo content. In a conventional video codec, a video is encodedaccording to a limited encoding method based on a macroblock having apredetermined size.

Image data of a spatial domain is transformed into coefficients of afrequency region by using frequency transformation. A video codec splitsan image into blocks having predetermined sizes, performs discretecosine transformation (DCT) transformation on each block, and encodesfrequency coefficients in block units to perform a fast arithmeticoperation of the frequency transformation. The coefficients of thefrequency region are easily compressible types compared to the imagedata of the spatial domain. In particular, an image pixel value of thespatial domain is expressed as a prediction error through interprediction or intra prediction of the video codec, and thus if thefrequency transformation is performed on the prediction error, data maybe transformed to 0. The video codec replaces data that continuously andrepetitively occurs with data having small sizes, thereby reducing anamount of data.

SUMMARY

One or more exemplary embodiments provide a video encoding method andapparatus and a video decoding method and apparatus to generate arestored image having a minimum error with respect to an original image.

According to an aspect an exemplary embodiment, there is provided avideo decoding method including: parsing from a bitstream offset mergeinformation indicating whether offset parameters of a current block andoffset parameters of at least one neighboring block adjacent to thecurrent block are identical; restoring an offset type and offset valuesof the current block from the offset parameter of the current blockbased on the offset merge information; determining an edge class or apixel value band of a restored pixel of the current block based on anedge type or a pixel value band type of the current block indicating theoffset type; and determining an offset value corresponding to the edgeclass or the pixel value band of the restored pixel from the restoredoffset values of the current block and adjusting a pixel value of therestored pixel of the current block according to the restored offsetvalues of the current block.

According to an aspect of an exemplary embodiment, there is provided avideo encoding method including: determining an edge class according toan edge type of a current block from among blocks of video or a pixelvalue band according to a pixel value band type of the current block;determining an offset value corresponding to the edge class or the pixelvalue band based on difference values between restored pixels andoriginal pixels included in the edge class or the pixel value band; andwhen an offset parameter of each block comprises an offset typeindicating the edge type or the pixel value band type and an offsetcorresponding to the edge class or the pixel value band, based onidentities between offset parameters of the current block and offsetparameters of at least one neighboring block adjacent to the currentblock, encoding offset merge information of the current block indicatingwhether the offset parameter of the current block is encoded.

According to an aspect of an exemplary embodiment, there is provided avideo decoding apparatus including: an offset parameter parsing unitconfigured to parse from a bitstream offset merge information indicatingwhether offset parameters of a current block and offset parameters of atleast one neighboring block adjacent to the current block are identical,and to restore an offset type and offset values of the current blockfrom the offset parameter of the current block based on the offset mergeinformation; and an offset adjusting unit configured to determine anedge class or a pixel value band of a restored pixel based on an edgetype or a pixel value band type of the current block indicating theoffset type, and to determine an offset value corresponding to the edgeclass or the pixel value band of the restored pixel from the restoredoffset values of the current block and to adjust a pixel value of therestored pixel of the current block according to the restored offsetvalues of the current block.

According to an aspect of an exemplary embodiment, there is provided avideo encoding apparatus including: an offset determining unitconfigured to determine an edge class according to an edge type of acurrent block from among blocks of video or a pixel value band accordingto a pixel value band type of the current block, and to determine anoffset value corresponding to the edge class or the pixel value bandbased on difference values between restored pixels and original pixelsincluded in the edge class or the pixel value band; and an offsetparameter encoding unit configured to, when an offset parameter of eachblock comprises an offset type indicating the edge type or the pixelvalue band type and an offset corresponding to the edge class or thepixel value band, based on identities between offset parameters of thecurrent block and offset parameters of at least one neighboring blockadjacent to the current block, encode offset merge information of thecurrent block indicating whether the offset parameter of the currentblock is encoded.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects will become more apparent by describing indetail exemplary embodiments thereof with reference to the attacheddrawings in which:

FIG. 1 is a block diagram of a video encoding apparatus, according to anexemplary embodiment;

FIG. 2 is a block diagram of a video decoding apparatus, according to anexemplary embodiment;

FIG. 3 is a table of edge types and lengths for pixel classification,according to an exemplary embodiment;

FIG. 4 is a flowchart illustrating an offset value encoding process,according to an exemplary embodiment;

FIG. 5 is a diagram of candidate reference blocks used to merge offsetparameters, according to an exemplary embodiment;

FIG. 6 is a flowchart illustrating a video encoding method, according toan exemplary embodiment;

FIG. 7 is a flowchart illustrating a video decoding method, according toan exemplary embodiment;

FIG. 8 is a block diagram of a video encoding apparatus based on codingunits having a tree structure, according to an exemplary embodiment;

FIG. 9 is a block diagram of a video decoding apparatus based on codingunits having a tree structure, according to an exemplary embodiment;

FIG. 10 is a diagram for describing a concept of coding units accordingto an exemplary embodiment;

FIG. 11 is a block diagram of an image encoder based on coding unitsaccording to an exemplary embodiment;

FIG. 12 is a block diagram of an image decoder based on coding unitsaccording to an exemplary embodiment;

FIG. 13 is a diagram illustrating deeper coding units according todepths, and partitions according to an exemplary embodiment;

FIG. 14 is a diagram for describing a relationship between a coding unitand transformation units, according to an exemplary embodiment;

FIG. 15 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to an exemplary embodiment;

FIG. 16 is a diagram of deeper coding units according to depths,according to an exemplary embodiment;

FIGS. 17 through 19 are diagrams for describing a relationship betweencoding units, prediction units, and transformation units, according toan exemplary embodiment; and

FIG. 20 is a diagram for describing a relationship between a codingunit, a prediction unit or a partition, and a transformation unit,according to encoding mode information of Table 1.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

Hereinafter, the exemplary embodiments will be described more fully withreference to the accompanying drawings, in which the exemplaryembodiments are shown.

As used herein, the term “and/or” includes any and all combinations ofone or more of the associated listed items.

A video encoding method and a video decoding method that are performedby adjusting offset according to pixel classification according to anexemplary embodiment will be described with reference to FIGS. 1 through7 below. Also, an exemplary embodiment in which a video encoding methodand a video decoding method based on coding units having a treestructure uses an offset adjustment according to pixel classificationaccording to an exemplary embodiment will be described with reference totypes of pixel offsets or pixel bands and FIG. 20 below. Hereinafter, an“image” may mean a still image of video, a moving image thereof, i.e.,video itself.

First, a video encoding method and a video decoding method that areperformed by adjusting offset according to pixel classificationaccording to an exemplary embodiment will now be described withreference to FIGS. 1 through 7 below.

FIG. 1 is a block diagram of a video encoding apparatus 10, according toan exemplary embodiment.

The video encoding apparatus 10 according to an exemplary embodimentincludes an offset determining unit 12 and an offset parameter encodingunit 14.

The video encoding apparatus 10 according to an exemplary embodimentreceives images of video, splits each image into blocks, and encodes theimages for each block. A block type may be a square or a rectangle, andmay be an arbitrary geometrical shape. The block type is not limited toa data unit having a uniform size. The block according to an exemplaryembodiment may be a maximum encoding unit, an encoding unit, etc., amongencoding units in a tree structure. Video encoding and decoding methodsbased on the encoding units in the tree structure will be describedlater with reference to FIGS. 8 to 20.

The video encoding apparatus 10 according to an exemplary embodiment mayperform intra prediction, inter prediction, transformation, andquantization for each image block, generate samples, perform entropyencoding on the samples, and output the samples in a bitstream.

The video encoding apparatus 10 according to an exemplary embodiment mayencode an offset value indicating a difference value between a pixel ofan original image (an original pixel) and a pixel of a restored image (arestored pixel) to minimize an error between the original pixel and therestored pixel.

The video encoding apparatus 10 according to an exemplary embodiment maydetermine the offset value for each predetermined data unit such as apicture, a slice, a block, etc. An offset parameter including the offsetvalue and an offset type may be encoded for each predetermined dataunit.

The offset determining unit 12 according to an exemplary embodimentdetermines an edge type or a pixel value band type of a current block.The offset determining unit 12 may determine whether it is suitable toclassify pixels of the current block based on the edge type or the pixelvalue band type according to a pixel characteristic of the currentblock.

The edge type according to an exemplary embodiment may indicatedirections and sizes of edges formed by the restored pixel andneighboring pixels. Also, when a total range band of pixel values of thecurrent block is split into a predetermined number of bands, the pixelvalue band type according to an exemplary embodiment may indicate thetotal number of the bands of the pixel values, a range of each band,etc.

In a case where an offset value of the current block is determinedaccording to the edge type, the offset determining unit 12 according toan exemplary embodiment may determine an edge class that belongs to eachrestored pixel. The edge class according to an exemplary embodimentindicates whether a currently restored pixel is a pixel of an edge. Forexample, the edge class may indicate whether the currently restoredpixel is an extreme point of the edge, is an edge pixel constituting theedge, or is not a pixel constituting the edge, etc.

In the case where the offset value of the current block is determinedaccording to the edge type, the offset determining unit 12 according toan exemplary embodiment may compare a pixel value of the currentlyrestored pixel with pixel values of neighboring pixels disposedneighboring the currently restored pixel according to directions andsizes of edges and determine the edge class indicating whether thecurrently restored pixel is the edge pixel.

In a case where the offset value of the current block is determinedaccording to the pixel value band type, the offset determining unit 12according to an exemplary embodiment may determine a pixel value bandthat belongs to each restored pixel. The pixel value band according toan exemplary embodiment indicates a pixel value band to which the pixelvalue of the currently restored pixel belongs from among a plurality ofpixel value bands. The plurality of pixel value bands may be splitaccording to an equal pixel value range. Also, the plurality of pixelvalue bands may be split according to an unequal pixel value range. Thatis, the offset determining unit 12 may determine the pixel value bandindicating a pixel value range to which the pixel value of the currentlyrestored pixel belongs from among the plurality of pixel value bands.

The offset determining unit 12 according to an exemplary embodimentdetermines an offset value corresponding to an edge class or a pixelvalue band of a restored pixel by using difference values betweenrestored pixels and original pixels included in the same edge class orpixel value band as the restored pixel.

The offset determining unit 12 according to an exemplary embodiment mayan average of difference values between restored pixels and originalpixels included in the same edge class as the current edge class or thesame pixel value band as the current pixel value band, i.e. an averageerror of the restored pixels, as an offset value corresponding to thecurrent edge class or the current pixel value band.

The offset determining unit 12 may determine an edge class or a pixelvalue band for each restored pixel in the current block. Accordingly,the offset determining unit 12 may determine each offset valuecorresponding to each edge class of a block. Also, the offsetdetermining unit 12 may determine each offset value corresponding toeach pixel value band of the block.

The offset parameter encoding unit 14 according to an exemplaryembodiment may encode an offset type and an offset value of each block.The offset type according to an exemplary embodiment indicates the edgetype of each block or the pixel value band type thereof.

An offset parameter of each block may include the offset type and theoffset value of each block. If the offset type is the edge type, theoffset parameter may include offset values corresponding to each edgeclass. Also, if the offset type is the pixel value band type, the offsetparameter may include offset values corresponding to each pixel valueband. That is, the offset parameter encoding unit 14 may encode theoffset parameter for each block.

The offset parameter encoding unit 14 according to an exemplaryembodiment may encode offset merge information of the current blockindicating whether to encode an offset parameter of the current block,based on identities of offset parameters of the current block and atleast one neighboring block.

If at least one of offset parameters of a left block and a right blockof the current block is identical to the offset parameter of the currentblock, the offset parameter encoding unit 14 according to an exemplaryembodiment may encode the offset merge information except for the offsetparameter of the current block.

If the offset parameters of the left block and the right block of thecurrent block are different from the offset parameter of the currentblock, the offset parameter encoding unit 14 according to an exemplaryembodiment may encode the offset merge information and the offsetparameter of the current block.

If partial information of offset parameters of the neighboring block isidentical to the offset parameter of the current block, the offsetparameter encoding unit 14 according to an exemplary embodiment mayencode offset merge information of one bit, and encode only informationof the offset parameter of the current block except for the identicalpartial information of the offset parameters of the neighboring block tothe offset parameter of the current block. For example, if the currentblock and the neighboring block are identical in terms of offset values,the offset merge information of one bit and the offset type may beencoded for the current block.

The offset parameter encoding unit 14 according to an exemplaryembodiment may encode differential information between offset values ofthe neighboring block and a current offset.

If an offset is 0, the offset parameter encoding unit 14 according to anexemplary embodiment may encode an offset parameter other than theoffset.

The offset parameter encoding unit 14 according to an exemplaryembodiment may predict and encode at least one color component among aluma component and chroma components of the current block by referringto offset parameters of other color components. For example, the offsetparameters the luma component and the chroma components are predictedand encoded by sharing or mutually referring to offset parameters. Asanother example, offset parameters of a first chroma component and asecond chroma component are predicted and encoded by sharing or mutuallyreferring to offset parameters.

The video encoding apparatus 10 according to an exemplary embodiment mayinclude a central processor (not shown) that generally controls theoffset determining unit 12 and the offset parameter encoding unit 14.Alternatively, the offset determining unit 12 and the offset parameterencoding unit 14 may operate by their respective processors (not shown)that interactively operate, and thus the video encoding apparatus 10 maygenerally operate. Alternatively, the offset determining unit 12 and theoffset parameter encoding unit 14 may be controlled by the control of anexternal processor (not shown) of the video encoding apparatus 10according to an exemplary embodiment.

The video encoding apparatus 10 according to an exemplary embodiment mayinclude at least one data storage unit (not shown) that stores input andoutput data of the offset determining unit 12 and the offset parameterencoding unit 14. The video encoding apparatus 10 may include a memorycontrol unit (not shown) that controls data input and output of the datastorage unit (not shown).

The video encoding apparatus 10 according to an exemplary embodiment mayoperate in connection with an internal video encoding processorinstalled therein or an external video encoding processor to output avideo encoding result, thereby performing a video encoding operationincluding transformation. The internal video encoding processor of thevideo encoding apparatus 10 according to an exemplary embodiment mayinclude a separate processor as well as the video encoding apparatus 10,a central operating apparatus, or a graphic operating apparatus mayinclude a video encoding processing module to implement a basic videoencoding operation.

FIG. 2 is a block diagram of a video decoding apparatus 20, according toan exemplary embodiment.

The video decoding apparatus 20 according to an exemplary embodimentincludes an offset parameter parsing unit 22 and an offset adjustingunit 24.

The video decoding apparatus 20 according to an exemplary embodimentreceives a bitstream including encoded video data. The video decodingapparatus 20 may parse video samples encoded from the receivedbitstream, perform entropy encoding, inverse quantization, inversetransformation, and prediction and motion compensation on each imageblock, generate restored pixels, and generate a resultant restoredimage. Also, the video decoding apparatus 20 according to an exemplaryembodiment may receive an offset value indicating a difference valuebetween an original pixel and a restored pixel to minimize an errorbetween an original image and the restored image.

The offset parameter parsing unit 22 according to an exemplaryembodiment may parse from the bitstream offset merge informationindicating whether offset parameters of a current block and at least oneneighboring block from among blocks of video are identical to eachother.

The offset parameter parsing unit 22 according to an exemplaryembodiment may restore offset types and offset values among offsetparameters of the current block based on offset merge information of thecurrent block.

For example, the offset parameter parsing unit 22 may parse and restorean offset parameter of the current block from the bitstream if theoffset parameters of the current block and at least one neighboringblock are different from each other based on the offset mergeinformation of the current block. However, the offset parameter parsingunit 22 may restore the offset parameter of the current block by usingthe offset parameter of the at least one neighboring bock withoutparsing the offset parameter of the current block from the bitstream ifthe offset parameters of the current block and at least one neighboringblock are identical to each other based on the offset merge informationof the current block.

The offset adjusting unit 24 according to an exemplary embodiment maydetermine an edge class or a pixel value band of the restored pixel,based on an edge type or a pixel value band type of the current blockindicating an offset type of the current block.

The offset adjusting unit 24 according to an exemplary embodiment maydetermine an offset value corresponding to the edge class or the pixelvalue band of the restored pixel from offset values of the currentblock. The offset adjusting unit 24 may adjust a pixel value of therestored pixel by an offset.

The offset adjusting unit 24 according to an exemplary embodiment maydetermine an edge class or a pixel value band for each restored pixel ofthe current block. Accordingly, the offset adjusting unit 24 maydetermine an offset value corresponding to the determined edge class orpixel value band for each restored pixel among restored offset valuesand adjust each restored pixel by an offset.

If the offset type of the current block is the edge type, the offsetadjusting unit 24 according to an exemplary embodiment may compare pixelvalues of a current block pixel and neighboring pixels of a currentlyrestored pixel disposed according to an edge direction and an edge size,and determine an edge class of the currently restored pixel.Accordingly, the offset adjusting unit 24 may determine an offset valuecorresponding to the edge class of the currently restored pixel amongthe offset values. The offset adjusting unit 24 may calculate an averageof difference values between restored pixels included in the same edgeclass as a current edge class and original pixels and determine theaverage as an offset corresponding to the currently restored pixel.

If the offset type of the current block is the pixel value band type,the offset adjusting unit 24 according to an exemplary embodiment maydetermine a pixel value band to which the pixel value of the currentlyrestored pixel belongs, from among a plurality of bands. Accordingly,the offset adjusting unit 24 may determine an offset value correspondingto the pixel value band of the currently restored pixel from among therestored offset values. The offset value selected by the offsetadjusting unit 24 from the restored offset values may be an average ofdifference values between restored pixels included in the same pixelvalue band as a current pixel value band and original pixels.

For a more detailed description of the offset parameter adjusting unit22, if at least one of offset parameters of a left block and a rightblock of the current block is identical to the offset parameter of thecurrent block based on offset merge information, the offset parameter ofthe current block may be restored to be the same as the at least one ofoffset parameters of the left block and the right block of the currentblock. A block having an offset parameter that is to be referred to maybe determined from among neighboring blocks based on the offset mergeinformation.

Furthermore, if the offset parameters of the left block and the rightblock of the current block are different from the offset parameter ofthe current block based on offset merge information, the offsetparameter adjusting unit 22 may parse and restore the offset parameterof the current block from the bitstream.

Furthermore, if offset merge information of one bit parsed from thebitstream indicates that partial information of the offset parameters ofthe neighboring block is identical to the offset parameter of thecurrent block, the offset parameter adjusting unit 22 may restorepartial information of the offset parameter of the current block byusing the partial information of the offset parameters of theneighboring block. The remaining information of the offset parameter ofthe current block may be parsed and restored from the bitstream.

Furthermore, the offset parameter adjusting unit 22 may parse andrestore differential values of the offset values from the bitstream. Inthis case, the offset parameter adjusting unit 22 may combinedifferential information between offset values of the neighboring blockand offset values of the current block and predict and restore theoffset values of the current block.

Furthermore, the offset parameter adjusting unit 22 may restore theoffset value to 0 if the offset parameter does not include at least oneoffset value.

The offset parameter parsing unit 22 according to an exemplaryembodiment may predict and restore an offset parameter of at least onecolor component among a luma component and chroma components of thecurrent block by reciprocally referring to offset parameters of colorcomponents. For example, offset parameters of the luma component and thechroma components may be restored by sharing or referring to offsetparameters. As another example, offset parameters of a first chromacomponent and a second chroma component may be predicted and restored bysharing or referring to offset parameters.

The video decoding apparatus 20 according to an exemplary embodiment mayinclude a central processor (not shown) that generally controls theoffset parameter parsing unit 22 and the offset adjusting unit 24.Alternatively, the offset parameter parsing unit 22 and the offsetadjusting unit 24 may operate by their respective processors (not shown)that interactively operate, and thus the video decoding apparatus 20 maygenerally operate. Alternatively, the offset parameter parsing unit 22and the offset adjusting unit 24 may be controlled by the control of anexternal processor (not shown) of the video decoding apparatus 20according to an exemplary embodiment.

The video decoding apparatus 20 according to an exemplary embodiment mayinclude at least one data storage unit (not shown) that stores input andoutput data of the offset parameter parsing unit 22 and the offsetadjusting unit 24. The video decoding apparatus 20 may include a memorycontrol unit (not shown) that controls data input and output of the datastorage unit (not shown).

The video decoding apparatus 20 according to an exemplary embodiment mayoperate in connection with an internal video decoding processorinstalled therein or an external video decoding processor to restorevideo through video decoding, thereby performing a video decodingoperation. The internal video decoding processor of the video decodingapparatus 20 according to an exemplary embodiment may include a separateprocessor as well as the video decoding apparatus 20, a centraloperating apparatus, or a graphic operating apparatus may include avideo decoding processing module to implement a basic video decodingoperation.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment use a sample adaptive offset (SAO)to minimize an error between an original pixel and a restored pixel. Byusing the SAO according to an exemplary embodiment, the video encodingapparatus 10 classifies pixels of each image block into predeterminedpixel groups, allocates each pixel to a corresponding pixel group, andencodes an offset value indicating an average value of errors betweenoriginal pixels and restored pixels included in the same pixel group.

Samples are encoded and transmitted between the video encoding apparatus10 and the video decoding apparatus 20. That is, the video encodingapparatus 10 may encode samples and transmit the encoded samples asbitstream types, and the video decoding apparatus 20 may parse andrestore the samples from a received bitstream. The video encodingapparatus 10 and the video decoding apparatus 20 according to anexemplary embodiment adjust restored pixel values according to theoffset value determined through the pixel classification andencode/decode offset parameters to minimize the error between theoriginal pixel and the restored pixel. Signaling, which involvesencoding, transmitting, receiving, and decoding offset values as offsetparameters is performed between the video encoding apparatus 10 and thevideo decoding apparatus 20.

Therefore, by using the SAO according to an exemplary embodiment, thevideo decoding apparatus 20 may decode the received bitstream, generaterestored pixels for each image block, restore offset values from thebitstream, and adjust the restored pixels by corresponding offsets,thereby generating a restored image having a minimum error with respectto an original image.

Hereinafter, exemplary embodiments of classifying pixels into pixelgroups for the SAO according to an exemplary embodiment will now bedescribed. By using the SAO according an exemplary embodiment, pixelsmay be classified (i) according to edge types constituting restoredpixels or (ii) according to pixel value band types thereof. Whether toclassify pixels according to edge types or pixel value band types may bedefined by offset types according to an exemplary embodiment.

An exemplary embodiment of classifying pixels according to edge types byusing the SAO according to an exemplary embodiment will now bedescribed.

An edge class of each restored pixel included in a current block may bedetermined according to a current edge type determined for the currentblock. That is, edge classes of currently restored pixels may be definedby comparing pixel values of the currently restored pixels andneighboring pixels.

For example, the edge class may be determined according to <process1>below.

<Process 1>

Class=0;

for i, j∈Ω

if Rec(i, j)<Rec(x, y) then Class ++

if Rec(i, j)<Rec(x, y) then Class −−

x and y of a currently restored pixel Rec(x, y) denote a horizontalcoordinate and a vertical coordinate, respectively. i and j of aneighboring pixel Rec(i, j) neighboring the currently restored pixelRec(x, y) denote a horizontal coordinate and a vertical coordinate,respectively. Ω denotes a space range in which the neighboring pixelRec(i, j) is disposed, which is a comparison target of the currentlyrestored pixel Rec(x, y). That is, according to <Process 1> above, anedge class Class of the currently restored pixel Rec(x, y) may bedetermined according to the number of neighboring pixels Rec(i, j).Among the neighboring pixel Rec(i, j) disposed in a predetermined spacerange, the edge class Class may increase according to the number ofneighboring pixels Rec(i, j) having a greater pixel value than thecurrently restored pixel Rec(x, y), and the edge class Class maydecrease according to the number of neighboring pixels Rec(i, j) havinga smaller pixel value than the currently restored pixel Rec(x, y).

The <neighboring pixel space range Ω> in which the neighboring pixelRec(i, j) is disposed may be defined as presented below.

<Maximum Neighboring Pixel Range>(i,j)∈Ω, but (i,j)≠(x,y)x−M≤i≤x+M, & y−M≤j≤y+M

M denotes a maximum horizontal and vertical distance from the currentlyrestored pixel Rec(x, y) to the neighboring pixel Rec(i, j). Thus, themaximum neighboring pixel range may include the maximum number(4M{circumflex over ( )}2+4M) of neighboring pixels disposed around thecurrently restored pixel Rec(x, y). In this case, the edge class Classmay be in a range from a minimum of −(4M{circumflex over ( )}2+4M) to amaximum of (4M{circumflex over ( )}2+4M). A center value of the edgeclass Class range may indicate that the currently restored pixel Rec(x,y) is a pixel disposed around an edge other than an edge pixel. Thenumber of the neighboring pixel Rec(i, j) within the neighboring pixelspace range Ω may increase or decrease according to an edge type. M maybe 1 to minimize an operation amount.

For example, in a case where the edge type is a vertical edge, thecurrently restored pixel Rec(x, y) may be compared to a neighboringpixel disposed in a horizontal direction in terms of a pixel value. Thatis, the neighboring pixel space range Ω of the vertical edge may bedetermined as presented below.

<Neighboring Pixel Space Range Ω of Vertical Edge>(i,j)∈Ω, but (i,j)≠(x,y)x−M≤i≤x+M, & j=y

A type and size of the neighboring pixel space range Ω may be determinedaccording to an edge type such as the vertical edge, a horizontal edge,a diagonal edge, a strict maximum, and a strict minimum formed by pixelswithin the neighboring pixel space range Ω. An edge class valueindicates whether a pixel is included in an edge or is disposed aroundthe edge. Thus, an offset for correcting pixel values constituting theedge according to a combination of the edge type and the edge class maybe determined, and thus a pixel group may be defined according to thecombination of the edge type and the edge class.

The number of neighboring pixels included in the neighboring pixel spacerange Ω may be determined according to the edge type. The edge classvalue may be determined within a range of the number of neighboringpixels. Therefore, the video encoding apparatus 10 and the videodecoding apparatus 20 may encode and transmit and receive acorresponding offset value for each edge class of a current edge type,and adjust a restored pixel according to the offset value. Hereinafter,coefficients of edge classes according to a predetermined edge type arereferred to as lengths of an offset value that is to be encoded andtransmitted to the video decoding apparatus 20.

In a case where an offset value used for a predetermined combination ofthe edge type and the edge class, i.e., an offset value for an edgeclass N of the current edge type, is previously determined as 0, thereis no need to encode and transmit the offset value to the video decodingapparatus 20. In this case, the length for the predetermined combinationof the edge type and the edge class may be reduced.

Therefore, the video encoding apparatus 10 and the video decodingapparatus 20 may classify pixels according to an image characteristic,such as an edge type, determine an average error value between pixelshaving the same characteristic as an offset, and adjust restored pixelsaccording to the offset, thereby minimizing an error between an originalimage and a restored image.

FIG. 3 is a table of edge types 31, 32, 33, 34, 35, and 36 and lengthsfor pixel classification, according to an exemplary embodiment.

Indices 5, 4, 0, 1, 2, and 3 may be sequentially allocated to the edgetypes 31, 32, 33, 34, 35, and 36. The higher the hit ratio of appearanceof the edge types 31, 32, 33, 34, 35, and 36, the smaller the indices 5,4, 0, 1, 2, and 3 may be allocated to the edge types 31, 32, 33, 34, 35,and 36. An edge class of a currently restored pixel X0 may be determinedby comparing pixel values of the currently restored pixel X0 and eightneighboring pixels X1, X2, X3, X4, X5, X6, X7, and X8 adjacent to thecurrently restored pixel X0 with respect to the edge type 31 of theindex 5. In this case, the number of edge classes allocated to thecurrently restored pixel X0 is 17, and thus a length may be determinedas 17.

As described above, the number of edge classes is determined as 9 bycomparing currently restored pixel values of the currently restoredpixel X0 and four neighboring pixels X1, X2, X3, and X4 horizontally andvertically adjacent to the currently restored pixel X0 with respect tothe edge type 32 of the index 4, and thus a length may be determined as9.

Also, the number of edge classes is determined as 5 by comparingcurrently restored pixel values of the currently restored pixel X0 andtwo neighboring pixels X1 and X2 horizontally adjacent to the currentlyrestored pixel X0 with respect to the edge type 33 of the index 0, andthus a length may be determined as 5.

Also, the number of edge classes is determined as 5 by comparingcurrently restored pixel values of the currently restored pixel X0 andtwo neighboring pixels X3 and X4 horizontally adjacent to the currentlyrestored pixel X0 with respect to the edge type 34 of the index 1, andthus a length may be determined as 5.

Also, the number of edge classes is determined as 5 by comparingcurrently restored pixel values of the currently restored pixel X0 andtwo neighboring pixels X5 and X8 adjacent to the currently restoredpixel X0 in a diagonal direction of 135° with respect to the edge type35 of the index 2, and thus a length may be determined as 5.

Also, the number of edge classes is determined as 5 by comparingcurrently restored pixel values of the currently restored pixel X0 andtwo neighboring pixels X6 and X7 adjacent to the currently restoredpixel X0 in a diagonal direction of 45° with respect to the edge type 36of the index 3, and thus a length may be determined as 5.

For example, in a case where the edge type is a vertical edge like theedge type 33 of the index 0, and pixel values of the currently restoredpixel X0 and two neighboring pixels X1 and X2 horizontally adjacent tothe currently restored pixel X0 are compared, the edge class (Class) ofthe currently restored pixel X0 may be determined according to <process2>below.

<Process 2>

(1) IF(X0>X1 and X0<X2) then Class=2

(2) IF(X0>X1 and X1==X2) or (X0==X1 and X1>X2) then Class=1;

(3) IF(X0==X1 and X1==X2) or (X0==X1 and X1==X2) then Class=0;

(4) IF(X0<X1 and X1==X2) or (X0==X1 and X1<X2) then Class=−1;

(5) IF(X0<X1 and X0<X2) then Class=−2;

According to the <process 2> above, in a case where the currentlyrestored pixel X0 is (1) a local maximum point of an edge, (2) a pixelof a block edge, (3) a pixel other than the edge, (4) a pixel of aconcave edge, and (5) a local minimum point of the edge, respectively, acorresponding edge class may be determined. In a case where an edgeclass value is 0, since an offset value is highly likely to be 0, anedge class of a restored pixel may not be encoded.

Next, an exemplary embodiment of classifying pixels according to pixelvalue band types by using the SAO according to an exemplary embodimentwill now be described.

Pixel values of restored pixels may belong to one of pixel value bandsaccording to an exemplary embodiment. For example, a minimum value Minand a maximum value Max of pixel values may have a total range of 0, . .. , 2{circumflex over ( )}(p-1) according to p-bit sampling. A pixelvalue range (Min, Max) may be split into a number K of pixel valuebands. In a case where B_(k) denotes a maximum value of a kth pixelvalue band, the kth pixel value band may be split into [B₀, B₁-1], [B₁,B₂-1], [B₂, B₃-1], . . . , [B_(K-1), B_(K)]. In a case where a pixelvalue of the currently restored pixel Rec(x, y) belongs to [B_(K-1),B_(K)], a current pixel value band may be determined as k.

The pixel value bands may be split into equal types or unequal types.Such pixel value band types may be determined in consideration of theactual minimum value Min and maximum value Max. In this case, a splitreference of the pixel value bands may be encoded and transmitted orreceived and decoded between the video encoding apparatus 10 and thevideo decoding apparatus 20. In a case where the pixel value bands aresplit according to a theoretical range {0, . . . , 2^(p-1)} of pixelvalues, a pixel value band type may be determined without having to beencoded. Such pixel value band type may be defined as an offset type.

A pixel value band to which each pixel value belongs for each restoredpixel may be determined from among a plurality of pixel value bandsclassified according to pixel value band types. Also, an offset valueindicating an average of errors between an original pixel and a restoredpixel may be determined for each pixel value band.

Therefore, the video encoding apparatus 10 and the video decodingapparatus 20 may encode and transmit and receive a corresponding offsetvalue for each of the pixel value bands classified according to acurrent pixel value band type, and adjust a restored pixel according tothe offset. Also, a length of an offset value may be the same as thenumber of pixel value bands. The video encoding apparatus 10 may encodethe length and transmit the length to the video decoding apparatus 20.

In a case where an offset value used for a predetermined combination ofthe edge type and the edge class, i.e. an offset value for the kth pixelvalue band of the current pixel value band type, is previouslydetermined as 0, there is no need to encode and transmit the offsetvalue to the video decoding apparatus 20. In this case, the length forthe predetermined combination of the edge type and the edge class may bereduced.

For example, in a case where a pixel value classification type is an8-bit equal band, pixel values may be split into 32 pixel value bands.More specifically, pixel values may be split into pixel value bands [0,7], [8, 15], . . . , [240, 247], [248, 255]. In this case, the length is32.

In a case where the total number of pixel value bands, i.e. length, isthe power of 2, an operation amount for classifying pixels according topixel value band types according to an exemplary embodiment may beminimized.

Therefore, the video encoding apparatus 10 and the video decodingapparatus 20 may classify pixels according to an image characteristic,such as a pixel value band type, determine an average error valuebetween pixels having the same characteristic as an offset, and adjustrestored pixels according to the offset, thereby minimizing an errorbetween an original image and a restored image.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may determine an offset type and anoffset value for each predetermined region. The video encoding apparatus10 may determine an error between an original pixel value and a restoredpixel value for each pixel included in predetermined regions, anddetermine an average of pixel errors as an offset value. For promptoperation, the video encoding apparatus 10 and the video decodingapparatus 20 may determine and transmit or receive an offset value foreach block.

The offset type may be determined according to an image characteristicof each block. For example, a block including a vertical edge, ahorizontal edge, a diagonal edge, etc. is preferable to classify pixelvalues according to edge types and determine an offset value forcorrection of an edge value. In a case where a block is not an edgeblock, the offset value may be preferably determined according to bandclassification. Thus, the video encoding apparatus 10 and the videodecoding apparatus 20 may transmit or receive the offset type for eachblock.

An offset parameter according to an exemplary embodiment may include anoffset type, offset values, length, and an offset class. The length maybe determined according to offset types.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may determine the offset classcorresponding to the offset type.

Therefore, the video encoding apparatus 10 according to an exemplaryembodiment may encode and transmit the offset type and offset values ofthe offset parameter to the video decoding apparatus 20. The videodecoding apparatus 20 may receive the offset type and offset values anddetermine the length and the offset class based on the offset type.Also, the video decoding apparatus 20 may select an offset valuecorresponding to the length or the offset class from the received offsetvalues and adjust restored pixels according to the offset value.

The video encoding apparatus 10 according to an exemplary embodiment maydetermine an index of an offset type according to a hit ratio ofappearance of the offset type to encode the offset type. For example,the higher the hit ratio of appearance of the offset type of the indexamong offset types, the shorter the codeword of the index may beencoded.

The video encoding apparatus 10 and the video decoding apparatus 20 mayhave the following examples of indices of the offset type selectablefrom among offset types including pixel classification according to theedge type and the pixel value band type:

-   -   (i) In a case where SAO is not used, an offset type is −1;    -   (ii) In a case of an edge type including three pixels in a        vertical direction, an offset type is 0;    -   (iii) In a case of an edge type including three pixels in a        horizontal direction, an offset type is 1;    -   (iv) In a case of an edge type including three pixels in a        diagonal direction of 135°, an offset type is 2;    -   (v) In a case of an edge type including three pixels in a        diagonal direction of 45°, an offset type is 3;    -   (vi) An offset type of a pixel value band type is 4.

In the case where (ii) the offset type is 0, an edge class may beencoded to {−2, −1, 1, 2}. The edge class 0 may not be encoded, and thusa length may be 4. In the case where (vi) the offset type is 4, and thenumber of pixel value bands is 32, a length may be 32.

FIG. 4 is a flowchart illustrating an offset value encoding process,according to an exemplary embodiment.

An offset value that is to be encoded and decoded is highly likely to be0 for transmitting and receiving between the video encoding apparatus 10and the video decoding apparatus 20 according to an exemplaryembodiment. An offset value other than 0 has a positive or negativesign. Thus, the video encoding apparatus 10 according to an exemplaryembodiment determines whether a current offset value is 0 (operation41), and, if the current offset value is not 0, determines whether thecurrent offset value is greater than 0 (operation 42). If the currentoffset value is greater than 0, a sign bit “0” is encoded (operation44). If the current offset value is not greater than 0, a sign bit “1”is encoded (operation 43). After the sign bit is encoded, a bit rategenerated by performing unary binary-coding on a value obtained byreducing an absolute value of the offset value by 1 may be furtherencoded (operation 45). The video encoding apparatus 10 may finallyencode the current offset value “0” if the current offset value is “0”(operation 46), and completely encode the offset value.

The video decoding apparatus 20 may receive the offset value, determinewhether the offset value is 0, and if the offset value is not 0, parsethe sign bit and a value obtained by reducing the absolute value of theoffset value by 1, and restore the current offset value.

An offset parameter according to an exemplary embodiment may bedetermined and transmitted and received for each block. For example, thevideo encoding apparatus 10 and the video decoding apparatus 20 maydetermine and transmit and receive the offset parameter for each pictureor each slice. Alternatively, the video encoding apparatus 10 and thevideo decoding apparatus 20 may determine and transmit and receive theoffset parameter for each encoding unit or a maximum encoding unit of atree structure. Video encoding/decoding operations based on encodingunits of the tree structure including the maximum encoding unit andencoding units of the tree structure according to an exemplaryembodiment will be described in more detail with reference to FIGS. 8 to20.

An offset type and/or an offset value of each block is highly likely tobe identical between adjacent blocks. In a case where an offsetparameter of a current block is compared to offset parameters ofneighboring blocks and is identical thereto, the video encodingapparatus 10 according to an exemplary embodiment may merge and encodethe offset parameters of the current block and neighboring blocks intoone offset parameter. If the offset parameters of the neighboring blocksare first encoded, the offset parameter of the current block may not beencoded, but offset merge information of the current block may beencoded.

The video decoding apparatus 20 according to an exemplary embodiment mayfirst parse the offset merge information and determine whether theoffset parameter is parsed before parsing the offset parameter from areceived bitstream. The video decoding apparatus 20 may determinewhether there is a block having the same offset parameter as the currentblock in the offset parameters of the neighboring blocks based on theoffset merge information of the current block.

For example, if it is determined that there is the block having the sameoffset parameter as the current block in the offset parameters of theneighboring blocks based on the offset merge information of the currentblock, the video decoding apparatus 20 may not parse the offsetparameter of the current block but may restore the offset parameter ofthe current block as same as a restored offset parameter of theneighboring block. Also, a neighboring block having an offset parameterthat is to be referred to may be determined from among the neighboringblocks based on the offset merge information.

For example, in a case where the offset parameters of the neighboringblocks are different from the offset parameter of the current blockbased on the offset merge information, the video decoding apparatus 20may parse and restore the offset parameter of the current block from thebitstream.

FIG. 5 is a diagram of candidate reference blocks used to merge offsetparameters, according to an exemplary embodiment.

The video encoding apparatus 10 according to an exemplary embodiment maydetermine a candidate list of neighboring blocks that are referencetargets of offset parameters of a current block 50 from amongneighboring blocks restored prior to the current block. The videoencoding apparatus 10 may compare the neighboring blocks of thecandidate list with the offset parameters of the current block 50.

The candidate list according to an exemplary embodiment may includeneighboring blocks disposed in a current frame 57 that is identical tothe current block 50. More specifically, a left block 51, an upper block52, a left upper block 53, and a right upper block 54 may be included inthe candidate list.

The video encoding apparatus 10 according to another exemplaryembodiment may refer to offset parameters of blocks 55 and 56 includedin neighboring frames 58 and 59 restored prior to the current frame 57.The blocks 55 and 59 included in the neighboring frames 58 and 59 may beblocks temporally disposed in previous and subsequent frames 58 and 59of the current frame 57 and spatially in the same region as the currentblock 50. In this case, the candidate list may include neighboringblocks 51, 52, 53, and 54 included in the current frame 57 and theblocks 55 and 59 included in the neighboring frames 58 and 59.

Therefore, the video encoding apparatus 10 according to an exemplaryembodiment may compare offset parameters of the neighboring blocksincluded in the candidate list with the offset parameters of the currentblock 50 according to a predetermined reference sequence. For example,the offset parameters of the neighboring blocks may be compared with theoffset parameters of the current block 50 according to the referencesequence of the left block 51, the upper block 52, the left upper block53, the right upper block 54, a previous block 55, and a subsequentblock 56. A neighboring block having the same offset parameter as thecurrent block 50 from among the compared neighboring blocks may bedetermined as a reference block.

The video encoding apparatus 10 and the video decoding apparatus 20 maypredict and refer to, and encode and transmit, or receive and decode,offset parameters between adjacent blocks based on the same candidatelist. The video decoding apparatus 20 according to an exemplaryembodiment may determine a neighboring block having the same offsetparameter as the current block 50 from the candidate list based onoffset merge information, and refer to an offset parameter of thecorresponding neighboring block to restore the offset parameter of thecurrent block 50 having the same value as the offset parameter of thecorresponding neighboring block.

For example, a candidate list including the left block 51 and the upperblock 52 is assumed to be used. The offset parameter encoding unit 14according to an exemplary embodiment may encode, as the offset mergeinformation, left offset merge information indicating whether an offsetparameter of the left block 51 is identical to the offset parameter ofthe current block 50 and upper offset merge information indicatingwhether an offset parameter of the upper block 52 is identical to theoffset parameter of the current block 50. In this case, the currentblock 50 may be compared with the left block 51 to determine whethertheir offset parameters are identical to each other, and then thecurrent block 50 may be compared with the upper block 52 to determinewhether their offset parameters are identical to each other. The offsetmerge information may be determined according to comparison results.

If at least one offset parameter of the left block 51 and the upperblock 52 is identical to the offset parameter of the current block 50,the offset parameter encoding unit 14 may encode the corresponding leftoffset merge information and upper offset merge information, but may notencode the offset parameter of the current block 50.

If the offset parameters of the left block 51 and the upper block 52 aredifferent from the offset parameter of the current block 50, the offsetparameter encoding unit 14 may encode the corresponding left offsetmerge information and upper offset merge information and the offsetparameter of the current block 50.

If the offset parameters of the left block 51 and the upper block 52 aredifferent from the offset parameter of the current block 50, the offsetparameter encoding unit 14 according to an exemplary embodiment mayencode offset merge information and the offset parameter of the currentblock 50.

As another example, if partial information of the offset parameters ofthe neighboring blocks is identical to the offset parameter of thecurrent block 50, the offset parameter encoding unit 14 according to anexemplary embodiment may encode offset merge information of one bit andremaining information of a current offset parameter except for theidentical partial information of the offset parameters of theneighboring blocks. For example, if the current block 50 and theneighboring blocks are identical to each other in terms of an offsetvalue, the offset merge information of one bit and an offset type valuemay be encoded for the current block 50.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may compare offset types and offsetvalues between the current block 50 and the neighboring blocks, and, ifthere is a neighboring bock having the same offset type and offset valueas the current block 50, may transmit and receive the offset mergeinformation.

As another example, offset types are compared among the offsetparameters of the current block 50 and the neighboring blocks, and, ifthere is a neighboring block having the same offset type as the currentblock 50, merge information of an offset type of the correspondingneighboring block may be transmitted and received.

As another example, offset values are compared among the offsetparameters of the current block 50 and the neighboring blocks, and, ifthere is a neighboring block having the same offset value as the currentblock 50, merge information of an offset value of the correspondingneighboring block may be transmitted and received.

If adjacent blocks are identical in terms of length although offsettypes are different between the adjacent blocks, offset values of theadjacent blocks may be similar. For example, the adjacent blocks arehighly likely to constitute the same object region among objectsindicated by an image. Thus, although an edge type of the current block50 that is a vertical edge is different from an edge type of aneighboring block that is a diagonal edge, pixels of the current block50 and the neighboring block may constitute the same object region.Thus, an offset value of the current block 50 and an offset value of theneighboring block may tend to be similar. Accordingly, a candidate listof neighboring blocks for the current block 50 may include neighboringblocks only having the same length of the edge type.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may predict the offset parameter ofthe current block 50 by referring to offset parameters of neighboringbocks between blocks having the same length.

In a case where prediction encoding is performed on an offset parameter,the video encoding apparatus 10 and the video decoding apparatus 20 maysignal a prediction candidate list including neighboring blocks that maybe referred to perform prediction encoding on the offset parameter.Alternatively, an offset parameter of a block that is most adjacent tothe current block 50 is always referred to, and thus the most adjacentblock included in the prediction candidate list may not be transmittednor received.

The prediction candidate list including the most adjacent block of thecurrent block 50 according to an exemplary embodiment may (i) includecandidate blocks arranged in a reference sequence (ii) among candidateblocks that are restored prior to the current block 50 and have the samelength, (iii) except for candidate blocks having the same offsetparameter. A first rank candidate block of the prediction candidate listmay be the most adjacent block. For example, if the prediction candidatelist includes the left block 51 and the upper block 52 disposed at thesame distance from the current bock 50, the left block 51 having asmaller operation amount necessary to access from the current bock 50than the upper block 52 may be the most adjacent block.

After the prediction candidate list is determined, prediction encodingmay be performed on offset values of the current block 50 by referringto offset values of the most adjacent block. Difference values betweenoffset values of the current block 50 and offset values of the mostadjacent bock may be encoded and transmitted or received.

<Offset Prediction Value>Offset[i]−Offset_prediction[i],O≤i≤Length−1

That is, according to an <Offset prediction value>, difference valuesOffset[i]−Offset_prediction[i] between offset values Offset[i] of thecurrent block 50 and offset values Offset_prediction[i] of the mostadjacent block may be encoded and transmitted or received for each edgeclass i (or each pixel value band) between the current block 50 and themost adjacent block having the same length (Length). Whenever the edgeclass i (or the pixel value band) changes, a prediction differentialvalue with respect to a corresponding edge class (or a correspondingpixel value band) may be transmitted or received.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may limitedly perform mergeencoding or prediction encoding on the offset parameter. For example, toencode the offset parameters of the current block 50 according to thepixel value band type, although two neighboring blocks have the samelength, i.e. the same number of pixel value bands, maximum and minimumvalues of the neighboring blocks and maximum and minimum values of thecurrent block 50 are different, and thus if an overall range of pixelvalues is different between the neighboring blocks and the current block50, offset parameters of the neighboring blocks and the offsetparameters of the current block 50 have no relation according to thepixel value band type. Therefore, if the neighboring blocks and thecurrent block 50 are different in terms of a characteristic of theoffset type, the video encoding apparatus 10 and the video decodingapparatus 20 are not preferable to merge and perform prediction encodingon offset parameters between adjacent blocks.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may perform prediction encoding onoffset parameters for each color component.

For example, an SAO may be applied to both a luma block and chromablocks of a YUV color format. An offset type and/or offset values of theluma block of a Y component may be quite similar to offset types and/oroffset values of the chroma blocks of U and V components.

For example, the video encoding apparatus 10 and the video decodingapparatus 20 adds a luma block at the same location as a current chromablock to a candidate list of the current chroma block, and thus anoffset parameter of the current chroma block may be predicted byreferring to an offset parameter of the luma block. The highest prioritymay be allocated to a luma block from among a reference list of blocksincluded in the candidate list.

As another example, the video encoding apparatus 10 and the videodecoding apparatus 20 may encode offset parameters based onpredetermined relations between the offset parameters of the lumacomponent and the chroma components. In general, the chroma blocks areflatter than the luma block, and absolute values of offset valuesaccording to maximum and minimum values, edge classes, and pixel valuesbands of the chroma blocks are smaller than those of the luma block.

A <chroma offset prediction equation> below explains an exemplaryembodiment of performing prediction encoding of offset values of thechroma blocks in a case where the offset values of the chroma blocks aredetermined based on an offset value of the luma block.

<Chroma Offset Prediction Equation>Value_to_be_encoded[i]=Offset[i]−F(Offset_prediction[i]);wherein F(x)=A*x+B;

In this regard, i denotes a current edge class (a pixel value band)within a length range, and an error value Value_to_be_encoded[i] betweena prediction value F(Offset_prediction[i]) and the offset valuesOffset[i] of the chroma blocks determined based on the offset valueOffset_prediction[i]) of the luma block to which the chroma blocks refermay be transmitted or received between the video encoding apparatus 10and the video decoding apparatus 20.

In F(x), A and B denote correlation parameters between the luma blockand the chroma blocks. The correlation parameters A and B may beseparately set for the U component and the Y component. Alternatively,the U component and the Y component may share the correlation parametersA and B.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may encode and transmit or receiveand decode the correlation parameters A and B, to perform predictionencoding on offset values between the luma block and the chroma blocksbased on correlations between the color components. The correlationparameters A and B may be previously fixed as predetermined valuesaccording to an exemplary embodiment. The correlation parameters A and Baccording to an exemplary embodiment may be determined for eachpredetermined data unit such as a block, a picture, a slice, a videosequence, etc. and may be transmitted or received after being includedin parameters for each block, a picture parameter set (PPS), a sliceheader, and a sequence parameter set (SPS).

FIG. 6 is a flowchart illustrating a video encoding method, according toan exemplary embodiment.

In operation 61, an edge class according to an edge type of a currentblock from among blocks of video may be determined or a pixel value bandaccording to a pixel value band type may be determined.

In a case where an offset of the current block is determined accordingto the edge type, the edge class indicating whether a currently restoredpixel is an extreme point from among neighboring pixels of the currentlyrestored pixel disposed according to an edge direction and edge size maybe determined by comparing pixel values of the currently restored pixeland the neighboring pixels.

Also, in a case where the offset of the current block is determinedaccording to pixel value band types of restored pixels, the pixel valueband indicating a pixel value range to which the pixel value of thecurrently restored pixel belongs may be determined from among aplurality of bands.

In operation 63, an offset corresponding to a current edge class orpixel value band is determined by using difference values betweenrestored pixels and original pixels included in the edge class or thepixel value band. An average value of difference values between restoredpixels and original pixels included in the same edge class or the samepixel value band may be determined as an offset value.

In operation 65, an offset parameter of each block is encoded. Theoffset parameter may include an offset type of a corresponding block, anoffset value thereof, length thereof, and an edge class and pixel valueband thereof.

The offset type of each block indicates an edge type or pixel value bandtype of a corresponding block. Restored pixels of each block areclassified into a plurality of edge classes according to the edge typeof each block, and each offset value is determined for each edge class,and thus a plurality of offset values corresponding to the plurality ofedge classes are determined. Alternatively, restored pixels of eachblock are classified into a plurality of pixel value bands according tothe edge type of each block, and each offset value is determined foreach pixel value band, and thus a plurality of offset valuescorresponding to the plurality of pixel value bands are determined. Thelength is determined according to the edge type of each block or pixelvalue band thereof. Thus, only the offset type and offset values amongthe offset parameters of each block may be encoded.

Offset merge information of the current block may be encoded based onidentities between offset parameters of the current block and at leastone neighboring block. The offset merge information may indicate whetheran offset parameter of the current block is encoded. That is, ifneighboring blocks include a block having the same offset parameter asthat of the current block, only the offset merge information of thecurrent block may be encoded, and the offset parameter thereof may notbe encoded.

Differential information between offset parameters of neighboring blocksand the offset parameter of the current block may be encoded byperforming prediction on the offset parameters of neighboring blocks andthe offset parameter of the current block. Prediction encoding may beperformed on at least one color component among a luma block and chromablocks of the current block by referring to each other's offsetparameters.

FIG. 7 is a flowchart illustrating a video decoding method, according toan exemplary embodiment.

In operation 71, offset merge information indicating whether offsetparameters of a current block and at least one neighboring block fromamong blocks of video are identical to each other is parsed from areceived bitstream.

In operation 73, offset types and offset values among the offsetparameters of the current block are restored based on the offset mergeinformation.

In operation 75, an edge class of a restored pixel or a pixel value bandthereof is determined based on an edge type of the current block or apixel value band type thereof indicating the offset type.

In operation 77, an offset value corresponding to the edge class of therestored pixel or the pixel value band thereof is determined from theoffset values, and a pixel value of the restore pixel is adjustedaccording to the offset value.

In a case where the offset type of the current block is the edge type inoperation 75, an edge class of a currently restored pixel may bedetermined by comparing pixel values of the currently restored pixel andneighboring pixels of the currently restored pixel disposed according toan edge direction and edge size. In this case, in operation 77, anoffset corresponding to the edge class of the currently restored pixelmay be selected from received offset values.

Also, in a case where the offset type of the current block is the pixelvalue band type in operation 75, a pixel value band of the currentlyrestored pixel may be determined, and in operation 77, an offsetcorresponding to the pixel value band of the currently restored pixelmay be selected from offset values.

If at least one offset parameter of a left block and an upper block ofthe current block is identical to the offset parameter of the currentblock based on the offset merge information in operation 71, the offsetparameter of the current block may be restored as same as the at leastone offset parameter of the left block and the upper block of thecurrent block. Also, if the at least one offset parameter of the leftblock and the upper block of the current block is different from theoffset parameter of the current block based on the offset mergeinformation, the offset parameter of the current block may be parsedfrom the received bitstream and may be restored.

If differential values of the offset values are parsed from thebitstream in operation 71, prediction restoration may be performed onthe offset values of the current bock by combining differentialinformation between offset values and offset information of neighboringblocks.

Prediction restoration may be performed on at least one color componentamong the luma component and the chroma components of the current blockby referring to each other's offset parameters in operation 71.

Therefore, the video encoding apparatus 10 and the video decodingapparatus 20 using the SAO according to an exemplary embodiment classifypixel values according to an image characteristic such as edge types ofimage blocks or pixel value band types thereof, encode and transmit orreceive and decode an offset value that is an average error valuebetween pixel values classified having the same characteristic, andadjust pixel values that are not expected among restored pixelsaccording to the offset value, thereby minimizing an error between anoriginal image and a restored image.

The video encoding apparatus 10 and the video decoding apparatus 20according to an exemplary embodiment may split blocks that are splitfrom video data into encoding units of a tree structure, and determinean offset set according to pixel classification for each maximumencoding unit or each coding unit as described above. A video encodingmethod and apparatus and a video decoding method and apparatus based oncoding units and transformation units having a tree structure accordingto an exemplary embodiment will be described with reference to FIGS. 7to 20 below.

FIG. 8 is a block diagram of a video encoding apparatus 100 based oncoding units having a tree structure, according to an exemplaryembodiment.

The video encoding apparatus 100 involving video prediction based oncoding units having the tree structure according to an exemplaryembodiment includes a maximum coding unit splitter 110, a coding unitdeterminer 120, and an output unit 130. For convenience of description,the video encoding apparatus 100 involving video prediction based oncoding units having the tree structure according to an exemplaryembodiment will hereinafter be referred to as the “video encodingapparatus 100”.

The maximum coding unit splitter 110 may split a current picture basedon a maximum coding unit for the current picture of an image. If thecurrent picture is larger than the maximum coding unit, image data ofthe current picture may be split into the at least one maximum codingunit. The maximum coding unit according to an exemplary embodiment maybe a data unit having a size of 32×32, 64×64, 128×128, 256×256, etc.,wherein a shape of the data unit is a square having a width and lengthin squares of 2. The image data may be output to the coding unitdeterminer 120 according to the at least one maximum coding unit.

A coding unit according to an exemplary embodiment may be characterizedby a maximum size and a depth. The depth denotes a number of times thecoding unit is spatially split from the maximum coding unit, and as thedepth deepens, deeper encoding units according to depths may be splitfrom the maximum coding unit to a minimum coding unit. A depth of themaximum coding unit is an uppermost depth and a depth of the minimumcoding unit is a lowermost depth. Since a size of a coding unitcorresponding to each depth decreases as the depth of the maximum codingunit deepens, a coding unit corresponding to an upper depth may includea plurality of coding units corresponding to lower depths.

As described above, the image data of the current picture is split intothe maximum coding units according to a maximum size of the coding unit,and each of the maximum coding units may include deeper coding unitsthat are split according to depths. Since the maximum coding unitaccording to an exemplary embodiment is split according to depths, theimage data of a spatial domain included in the maximum coding unit maybe hierarchically classified according to depths.

A maximum depth and a maximum size of a coding unit, which limit thetotal number of times a height and a width of the maximum coding unitare hierarchically split may be predetermined.

The coding unit determiner 120 encodes at least one split regionobtained by splitting a region of the maximum coding unit according todepths, and determines a depth to output a finally encoded image dataaccording to the at least one split region. In other words, the codingunit determiner 120 determines a coded depth by encoding the image datain the deeper coding units according to depths, according to the maximumcoding unit of the current picture, and selecting a depth having theleast encoding error. Thus, the encoded image data of the coding unitcorresponding to the determined coded depth is finally output. Also, thecoding units corresponding to the coded depth may be regarded as encodedcoding units.

The determined coded depth and the encoded image data according to thedetermined coded depth are output to the output unit 130.

The image data in the maximum coding unit is encoded based on the deepercoding units corresponding to at least one depth equal to or below themaximum depth, and results of encoding the image data are compared basedon each of the deeper coding units. A depth having the least encodingerror may be selected after comparing encoding errors of the deepercoding units. At least one coded depth may be selected for each maximumcoding unit.

The size of the maximum coding unit is split as a coding unit ishierarchically split according to depths, and as the number of codingunits increases. Also, even if coding units correspond to same depth inone maximum coding unit, it is determined whether to split each of thecoding units corresponding to the same depth to a lower depth bymeasuring an encoding error of the image data of the each coding unit,separately. Accordingly, even when image data is included in one maximumcoding unit, the image data is split to regions according to the depthsand the encoding errors may differ according to regions in the onemaximum coding unit, and thus the coded depths may differ according toregions in the image data. Thus, one or more coded depths may bedetermined in one maximum coding unit, and the image data of the maximumcoding unit may be divided according to coding units of at least onecoded depth.

Accordingly, the coding unit determiner 120 may determine coding unitshaving a tree structure included in the maximum coding unit. The ‘codingunits having a tree structure’ according to an exemplary embodimentinclude coding units corresponding to a depth determined to be the codeddepth, from among all deeper coding units included in the maximum codingunit. A coding unit of a coded depth may be hierarchically determinedaccording to depths in the same region of the maximum coding unit, andmay be independently determined in different regions. Similarly, a codeddepth in a current region may be independently determined from a codeddepth in another region.

A maximum depth according to an exemplary embodiment is an index relatedto the number of splitting times from a maximum coding unit to a minimumcoding unit. A first maximum depth according to an exemplary embodimentmay denote the total number of splitting times from the maximum codingunit to the minimum coding unit. A second maximum depth according to anexemplary embodiment may denote the total number of depth levels fromthe maximum coding unit to the minimum coding unit. For example, when adepth of the maximum coding unit is 0, a depth of a coding unit, inwhich the maximum coding unit is split once, may be set to 1, and adepth of a coding unit, in which the maximum coding unit is split twice,may be set to 2. Here, if the minimum coding unit is a coding unit inwhich the maximum coding unit is split four times, 5 depth levels ofdepths 0, 1, 2, 3 and 4 exist, and thus the first maximum depth may beset to 4, and the second maximum depth may be set to 5.

Prediction encoding and transformation may be performed according to themaximum coding unit. The prediction encoding and the transformation arealso performed based on the deeper coding units according to a depthequal to or depths less than the maximum depth, according to the maximumcoding unit. Transformation may be performed according to method oforthogonal transformation or integer transformation.

Since the number of deeper coding units increases whenever the maximumcoding unit is split according to depths, encoding including theprediction encoding and the transformation is performed on all of thedeeper coding units generated as the depth deepens. For convenience ofdescription, the prediction encoding and the transformation will now bedescribed based on a coding unit of a current depth, in a maximum codingunit.

The video encoding apparatus 100 may variously select a size or shape ofa data unit for encoding the image data. To encode the image data,operations, such as prediction encoding, transformation, and entropyencoding, are performed, and at this time, the same data unit may beused for all operations or different data units may be used for eachoperation.

For example, the video encoding apparatus 100 may select not only acoding unit for encoding the image data, but also a data unit differentfrom the coding unit to perform the prediction encoding on the imagedata in the coding unit.

To perform prediction encoding in the maximum coding unit, theprediction encoding may be performed based on a coding unitcorresponding to a coded depth, i.e., based on a coding unit that is nolonger split to coding units corresponding to a lower depth.Hereinafter, the coding unit that is no longer split and becomes a basisunit for prediction encoding will now be referred to as a ‘predictionunit’. A partition obtained by splitting the prediction unit may includea prediction unit or a data unit obtained by splitting at least one of aheight and a width of the prediction unit. The partition is a data unitsplit from the prediction unit of the coding unit, and the predictionunit may be a partition having the same size as the coding unit.

For example, when a coding unit of 2N×2N (where N is a positive integer)is no longer split and becomes a prediction unit of 2N×2N, and a size ofa partition may be 2N×2N, 2N×N, N×2N, or N×N. Examples of a partitiontype include symmetrical partitions that are obtained by symmetricallysplitting a height or width of the prediction unit, partitions obtainedby asymmetrically splitting the height or width of the prediction unit,such as 1:n or n:1, partitions that are obtained by geometricallysplitting the prediction unit, and partitions having arbitrary shapes.

A prediction mode of the prediction unit may be at least one of an intramode, a inter mode, and a skip mode. For example, the intra mode or theinter mode may be performed on the partition of 2N×2N, 2N×N, N×2N, orN×N. Also, the skip mode may be performed only on the partition of2N×2N. The encoding is independently performed on one prediction unit ina coding unit, thereby selecting a prediction mode having a leastencoding error.

The video encoding apparatus 100 may also perform the transformation onthe image data in a coding unit based not only on the coding unit forencoding the image data, but also based on a data unit that is differentfrom the coding unit.

To perform the transformation in the coding unit, the transformation maybe performed based on a data unit having a size smaller than or equal tothe coding unit. For example, the data unit may include a data unit foran intra mode and a transformation unit for an inter mode.

A transformation depth indicating the number of splitting times to reachthe transformation unit by splitting the height and width of the codingunit may also be set in the transformation unit. For example, in acurrent coding unit of 2N×2N, a transformation depth may be 0 when thesize of a transformation unit is also 2N×2N, may be 1 when each of theheight and width of the current coding unit is split into two equalparts, totally split into 4{circumflex over ( )}1 transformation units,and the size of the transformation unit is thus N×N, and may be 2 wheneach of the height and width of the current coding unit is split intofour equal parts, totally split into 4{circumflex over ( )}2transformation units and the size of the transformation unit is thusN/2×N/2. For example, the transformation unit may be set according to ahierarchical tree structure, in which a transformation unit of an uppertransformation depth is split into four transformation units of a lowertransformation depth according to the hierarchical characteristics of atransformation depth.

Similarly to the coding unit, the transformation unit in the coding unitmay be recursively split into smaller sized regions, so that thetransformation unit may be determined independently in units of regions.Thus, residual data in the coding unit may be divided according to thetransformation having the tree structure according to transformationdepths.

Encoding information according to coding units corresponding to a codeddepth requires not only information about the coded depth, but alsoabout information related to prediction encoding and transformation.Accordingly, the coding unit determiner 120 not only determines a codeddepth having a least encoding error, but also determines a partitiontype in a prediction unit, a prediction mode according to predictionunits, and a size of a transformation unit for transformation.

A method of determining a coding unit according to a tree structure in amaximum coding unit, a prediction unit, a partition, and atransformation unit according to exemplary embodiments, will bedescribed in detail later with reference to FIGS. 7 through 19.

The coding unit determiner 120 may measure an encoding error of deepercoding units according to depths by using Rate-Distortion Optimizationbased on Lagrangian multipliers.

The output unit 130 outputs the image data of the maximum coding unit,which is encoded based on the at least one coded depth determined by thecoding unit determiner 120, and information about the encoding modeaccording to the coded depth, in bitstreams.

The encoded image data may be obtained by encoding residual data of animage.

The information about the encoding mode according to coded depth mayinclude information about the coded depth, about the partition type inthe prediction unit, the prediction mode, and the size of thetransformation unit.

The information about the coded depth may be defined by using splitinformation according to depths, which indicates whether encoding isperformed on coding units of a lower depth instead of a current depth.If the current depth of the current coding unit is the coded depth,image data in the current coding unit is encoded and output, and thusthe split information may be defined not to split the current codingunit to a lower depth. Alternatively, if the current depth of thecurrent coding unit is not the coded depth, the encoding is performed onthe coding unit of the lower depth, and thus the split information maybe defined to split the current coding unit to obtain the coding unitsof the lower depth.

If the current depth is not the coded depth, encoding is performed onthe coding unit that is split into the coding unit of the lower depth.Since at least one coding unit of the lower depth exists in one codingunit of the current depth, the encoding is repeatedly performed on eachcoding unit of the lower depth, and thus the encoding may be recursivelyperformed for the coding units having the same depth.

Since the coding units having a tree structure are determined for onemaximum coding unit, and information about at least one encoding mode isdetermined for a coding unit of a coded depth, information about atleast one encoding mode may be determined for one maximum coding unit.Also, a coded depth of the image data of the maximum coding unit may bedifferent according to locations since the image data is hierarchicallysplit according to depths, and thus information about the coded depthand the encoding mode may be set for the image data.

Accordingly, the output unit 130 may assign encoding information about acorresponding coded depth and an encoding mode to at least one of thecoding unit, the prediction unit, and a minimum unit included in themaximum coding unit.

The minimum unit according to an exemplary embodiment is a rectangulardata unit obtained by splitting the minimum coding unit constituting thelowermost depth by 4. Alternatively, the minimum unit may be a maximumrectangular data unit that may be included in all of the coding units,prediction units, partition units, and transformation units included inthe maximum coding unit.

For example, the encoding information output through the output unit 130may be classified into encoding information according to coding units,and encoding information according to prediction units. The encodinginformation according to the coding units may include the informationabout the prediction mode and about the size of the partitions. Theencoding information according to the prediction units may includeinformation about an estimated direction of an inter mode, about areference image index of the inter mode, about a motion vector, about achroma component of an intra mode, and about an interpolation method ofthe intra mode. Also, information about a maximum size of the codingunit defined according to pictures, slices, or GOPs, and informationabout a maximum depth may be inserted into a header of a bitstream, asequence parameter set, or a picture parameter set.

Also, information regarding a maximum size of a transformation unitallowed with respect to current video and information regarding aminimum size of the transformation unit may be output through the headerof the bitstream, the sequence parameter set, or the picture parameterset. The output unit 130 may encode and output reference information,bidirectional prediction information, slice type information including afourth slice type, etc. relating to the prediction described withreference to FIGS. 1 through 6.

In the video encoding apparatus 100, the deeper coding unit may be acoding unit obtained by dividing a height or width of a coding unit ofan upper depth, which is one layer above, by two. In other words, whenthe size of the coding unit of the current depth is 2N×2N, the size ofthe coding unit of the lower depth is N×N. Also, the coding unit of thecurrent depth having the size of 2N×2N may include maximum 4 of thecoding unit of the lower depth.

Accordingly, the video encoding apparatus 100 may form the coding unitshaving the tree structure by determining coding units having an optimumshape and an optimum size for each maximum coding unit, based on thesize of the maximum coding unit and the maximum depth determinedconsidering characteristics of the current picture. Also, since encodingmay be performed on each maximum coding unit by using any one of variousprediction modes and transformations, an optimum encoding mode may bedetermined considering characteristics of the coding unit of variousimage sizes.

Thus, if an image having high resolution or large data amount is encodedin a conventional macroblock, a number of macroblocks per pictureexcessively increases. Accordingly, a number of pieces of compressedinformation generated for each macroblock increases, and thus it isdifficult to transmit the compressed information and data compressionefficiency decreases. However, by using the video encoding apparatus100, image compression efficiency may be increased since a coding unitis adjusted while considering characteristics of an image whileincreasing a maximum size of a coding unit while considering a size ofthe image.

The video encoding apparatus 100 of FIG. 8 may perform an operation ofthe video encoding apparatus 10 described above with reference to FIG.1.

The coding unit determiner 120 may perform an operation of the offsetdetermining unit 12 of the video encoding apparatus 10. The coding unitdeterminer 120 may determine an offset value for each edge class byclassifying pixel values according to edge types for each maximum codingunit or determine an offset value for each pixel value band byclassifying pixel values according to pixel value band types. The offsetvalue of each pixel group such as the edge class or the pixel value bandmay be an average error value between restored pixels and originalpixels included in a corresponding pixel group. As another example, theedge class and the offset value or the pixel value band and the offsetvalue may be determined for each predetermined data unit such as acoding unit, a prediction unit, and a transformation unit.

The output unit 130 may encode the offset type and offset values amongoffset parameters determined for each maximum coding unit. In a casewhere the offset parameter is determined for each predetermined dataunit such as the coding unit, the prediction unit, and thetransformation unit, the offset type and offset values may be encoded asparameters of a corresponding data unit.

The output unit 130 may perform prediction encoding on a current offsetparameter of a current maximum coding unit by referring to neighboringoffset parameters of neighboring maximum coding units. The output unit130 may encode offset merge information for the current maximum codingunit without encoding the current offset parameter if at least one ofthe neighboring offset parameters is identical to the current offsetparameter. The output unit 130 may encode the offset merge informationand the current offset parameter for the current maximum coding unit ifthe neighboring offset parameters and the current offset parameter aredifferent from each other.

FIG. 9 is a block diagram of a video decoding apparatus 200 based oncoding units having a tree structure, according to an exemplaryembodiment.

The video decoding apparatus 200 involving video prediction based oncoding units having the tree structure according to an exemplaryembodiment includes a receiver 210, an image data and encodinginformation extractor 220, and an image data decoder 230. Forconvenience of description, the video decoding apparatus 200 involvingvideo prediction based on coding units having the tree structureaccording to an exemplary embodiment will hereinafter be referred to asthe “video decoding apparatus 200”.

Definitions of various terms, such as a coding unit, a depth, aprediction unit, a transformation unit, and information about variousencoding modes, for various operations of the video decoding apparatus200 are identical to those described with reference to FIG. 7 and thevideo encoding apparatus 100.

The receiver 210 receives and parses a bitstream of an encoded video.The image data and encoding information extractor 220 extracts encodedimage data for each coding unit from the parsed bitstream, wherein thecoding units have a tree structure according to each maximum codingunit, and outputs the extracted image data to the image data decoder230. The image data and encoding information extractor 220 may extractinformation about a maximum size of a coding unit of a current picture,from a header about the current picture or SPS.

Also, the image data and encoding information extractor 220 extractsinformation about a coded depth and an encoding mode for the codingunits having a tree structure according to each maximum coding unit,from the parsed bitstream. The extracted information about the codeddepth and the encoding mode is output to the image data decoder 230. Inother words, the image data in a bit stream is split into the maximumcoding unit so that the image data decoder 230 decodes the image datafor each maximum coding unit.

The information about the coded depth and the encoding mode according tothe maximum coding unit may be set for information about at least onecoding unit corresponding to the coded depth, and information about anencoding mode may include information about a partition type of acorresponding coding unit corresponding to the coded depth, about aprediction mode, and a size of a transformation unit. Also, splittinginformation according to depths may be extracted as the informationabout the coded depth.

The information about the coded depth and the encoding mode according toeach maximum coding unit extracted by the image data and encodinginformation extractor 220 is information about a coded depth and anencoding mode determined to generate a minimum encoding error when anencoder, such as the video encoding apparatus 100, repeatedly performsencoding for each deeper coding unit according to depths according toeach maximum coding unit. Accordingly, the video decoding apparatus 200may restore an image by decoding the image data according to a codeddepth and an encoding mode that generates the minimum encoding error.

Since encoding information about the coded depth and the encoding modemay be assigned to a predetermined data unit from among a correspondingcoding unit, a prediction unit, and a minimum unit, the image data andencoding information extractor 220 may extract the information about thecoded depth and the encoding mode according to the predetermined dataunits. The predetermined data units to which the same information aboutthe coded depth and the encoding mode is assigned may be inferred to bethe data units included in the same maximum coding unit.

The image data decoder 230 restores the current picture by decoding theimage data in each maximum coding unit based on the information aboutthe coded depth and the encoding mode according to the maximum codingunits. In other words, the image data decoder 230 may decode the encodedimage data based on the extracted information about the partition type,the prediction mode, and the transformation unit for each coding unitfrom among the coding units having the tree structure included in eachmaximum coding unit. A decoding process may include a predictionincluding intra prediction and motion compensation, and an inversetransformation. Inverse transformation may be performed according tomethod of inverse orthogonal transformation or inverse integertransformation.

The image data decoder 230 may perform intra prediction or motioncompensation according to a partition and a prediction mode of eachcoding unit, based on the information about the partition type and theprediction mode of the prediction unit of the coding unit according tocoded depths.

Also, the image data decoder 230 may perform inverse transformationaccording to each transformation unit in the coding unit, based on theinformation about the size of the transformation unit of the coding unitaccording to coded depths, to perform the inverse transformationaccording to maximum coding units.

The image data decoder 230 may determine at least one coded depth of acurrent maximum coding unit by using split information according todepths. If the split information indicates that image data is no longersplit in the current depth, the current depth is a coded depth.Accordingly, the image data decoder 230 may decode encoded data of atleast one coding unit corresponding to the each coded depth in thecurrent maximum coding unit by using the information about the partitiontype of the prediction unit, the prediction mode, and the size of thetransformation unit for each coding unit corresponding to the codeddepth, and output the image data of the current maximum coding unit.

In other words, data units containing the encoding information includingthe same split information may be gathered by observing the encodinginformation set assigned for the predetermined data unit from among thecoding unit, the prediction unit, and the minimum unit, and the gathereddata units may be considered to be one data unit to be decoded by theimage data decoder 230 in the same encoding mode. Decoding in thecurrent decoding unit may be performed by obtaining informationregarding the coding mode for the coding unit determined as describedabove.

Also, the video decoding apparatus 200 of FIG. 9 may perform anoperation of the video decoding apparatus 20 described above withreference to FIG. 2.

The receiver 210 and the image data and encoding information extractor220 may perform an operation of the offset parameter parsing unit 22 ofthe video decoding apparatus 20. The image data decoder 230 may performan operation of the offset adjusting unit 24 of the video decodingapparatus 20.

The image data and encoding information extractor 220 may restore acurrent offset parameter as same as at least one of neighboring offsetparameters in a case where offset merge information is only parsed froma bitstream without an offset parameter for a current maximum codingunit. A parameter that is to be referred to from among the neighboringoffset parameters may be determined based on the offset mergeinformation. The image data and encoding information extractor 220 mayparse and restore the current offset parameter for the current maximumcoding unit from the bitstream if the neighboring offset parameters andthe current offset parameter are determined to be different from eachother based on the offset merge information for the current maximumcoding unit parsed from the bitstream.

The image data and encoding information extractor 220 may performprediction restoration on the current offset parameter in the currentmaximum coding unit by referring to the neighboring offset parameters ofneighboring maximum coding units.

The image data decoder 230 may parse an offset parameter for eachmaximum coding unit from the bitstream. It may be determined whether anoffset type of the current maximum coding unit is an edge type or apixel value band type from the restored offset parameters. If the offsettype of the current maximum coding unit is the edge type, an edge classfor each restored pixel may be determined, and an offset valuecorresponding to the edge class of each restored pixel may be selectedfrom offset values the offset parameters. If the offset type of thecurrent maximum coding unit is the pixel value band type, each pixelvalue band for each restored pixel may be determined, and an offsetvalue corresponding to the pixel value band of each restored pixel maybe selected from offset values parsed and included in the offsetparameters.

The image data decoder 230 may generate a restored pixel having aminimum error with respect to an original pixel by adjusting acorresponding restored pixel value by an offset value corresponding toeach restored pixel. As another example, in a case where the offsetparameter is parsed for each predetermined data unit such as a codingunit, a prediction unit, and a transformation unit, an offset valuecorresponding to each edge class may be restored for each correspondingdata unit or an offset value corresponding to each pixel value band maybe restored.

In conclusion, the video decoding apparatus 200 may obtain informationabout at least one coding unit that generates the minimum encoding errorwhen encoding is recursively performed for each maximum coding unit, andmay use the information to decode the current picture. In other words,the coding units having the tree structure determined to be the optimumcoding units in each maximum coding unit may be decoded. Also, themaximum size of coding unit is determined considering resolution and anamount of image data.

Accordingly, even if image data has high resolution and a large amountof data, the image data may be efficiently decoded and restored by usinga size of a coding unit and an encoding mode, which are adaptivelydetermined according to characteristics of the image data, by usinginformation about an optimum encoding mode received from an encoder.

FIG. 10 is a diagram for describing a concept of coding units accordingto an exemplary embodiment.

A size of a coding unit may be expressed in width×height, and may be64×64, 32×32, 16×16, and 8×8. A coding unit of 64×64 may be split intopartitions of 64×64, 64×32, 32×64, or 32×32, and a coding unit of 32×32may be split into partitions of 32×32, 32×16, 16×32, or 16×16, a codingunit of 16×16 may be split into partitions of 16×16, 16×8, 8×16, or 8×8,and a coding unit of 8×8 may be split into partitions of 8×8, 8×4, 4×8,or 4×4.

In video data 310, a resolution is 1920×1080, a maximum size of a codingunit is 64, and a maximum depth is 2. In video data 320, a resolution is1920×1080, a maximum size of a coding unit is 64, and a maximum depth is3. In video data 330, a resolution is 352×288, a maximum size of acoding unit is 16, and a maximum depth is 1. The maximum depth shown inFIG. 10 denotes a total number of splits from a maximum coding unit to aminimum coding unit.

If a resolution is high or a data amount is large, a maximum size of acoding unit may be large to not only increase encoding efficiency butalso to accurately reflect characteristics of an image. Accordingly, themaximum size of the coding unit of the video data 310 and 320 having thehigher resolution than the video data 330 may be 64.

Since the maximum depth of the video data 310 is 2, coding units 315 ofthe vide data 310 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32 and 16 sincedepths are deepened to two layers by splitting the maximum coding unittwice. Meanwhile, since the maximum depth of the video data 330 is 1,coding units 335 of the video data 330 may include a maximum coding unithaving a long axis size of 16, and coding units having a long axis sizeof 8 since depths are deepened to one layer by splitting the maximumcoding unit once.

Since the maximum depth of the video data 320 is 3, coding units 325 ofthe video data 320 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32, 16, and 8since the depths are deepened to 3 layers by splitting the maximumcoding unit three times. As a depth deepens, detailed information may beprecisely expressed.

FIG. 11 is a block diagram of an image encoder 400 based on codingunits, according to an exemplary embodiment.

The image encoder 400 performs operations of the coding unit determiner120 of the video encoding apparatus 100 to encode image data. In otherwords, an intra predictor 410 performs intra prediction on coding unitsin an intra mode, from among a current frame 405, and a motion estimator420 and a motion compensator 425 performs inter estimation and motioncompensation on coding units in an inter mode from among the currentframe 405 by using the current frame 405, and a reference frame 495.

Data output from the intra predictor 410, the motion estimator 420, andthe motion compensator 425 is output as a quantized transformationcoefficient through a transformer 430 and a quantizer 440. The quantizedtransformation coefficient is restored as data in a spatial domainthrough an inverse quantizer 460 and an inverse transformer 470, and therestored data in the spatial domain is output as the reference frame 495after being post-processed through a deblocking unit 480 and a loopfiltering unit 490. The quantized transformation coefficient may beoutput as a bitstream 455 through an entropy encoder 450.

For the image encoder 400 to be applied in the video encoding apparatus100, all elements of the image encoder 400, i.e., the intra predictor410, the motion estimator 420, the motion compensator 425, thetransformer 430, the quantizer 440, the entropy encoder 450, the inversequantizer 460, the inverse transformer 470, the deblocking unit 480, andthe loop filtering unit 490 perform operations based on each coding unitfrom among coding units having a tree structure while considering themaximum depth of each maximum coding unit.

Specifically, the intra predictor 410, the motion estimator 420, and themotion compensator 425 determines partitions and a prediction mode ofeach coding unit from among the coding units having a tree structurewhile considering the maximum size and the maximum depth of a currentmaximum coding unit, and the transformer 430 determines the size of thetransformation unit in each coding unit from among the coding unitshaving a tree structure.

The image encoder 400 may classify pixels according to an edge type (ora pixel value band) for each maximum coding unit of the reference frame495, determine an edge class (or a pixel value band) for each restoredpixel, and determine an average error value of restored pixels thatbelong to each edge class (or each pixel value band). Offset types andoffset values for each maximum coding unit may be encoded andtransmitted or received and decoded.

FIG. 12 is a block diagram of an image decoder 500 based on codingunits, according to an exemplary embodiment.

A parser 510 parses encoded image data to be decoded and informationabout encoding required for decoding from a bitstream 505. The encodedimage data is output as inverse quantized data through an entropydecoder 520 and an inverse quantizer 530, and the inverse quantized datais restored to image data in a spatial domain through an inversetransformer 540.

An intra predictor 550 performs intra prediction on coding units in anintra mode with respect to the image data in the spatial domain, and amotion compensator 560 performs motion compensation on coding units inan inter mode by using a reference frame 585.

The image data in the spatial domain, which passed through the intrapredictor 550 and the motion compensator 560, may be output as arestored frame 595 after being post-processed through a deblocking unit570 and a loop filtering unit 580. Also, the image data that ispost-processed through the deblocking unit 570 and the loop filteringunit 580 may be output as the reference frame 585.

To decode the image data in the image data decoder 230 of the videodecoding apparatus 200, the image decoder 500 may perform operationsthat are performed after the parser 510.

For the image decoder 500 to be applied in the video decoding apparatus200, all elements of the image decoder 500, i.e., the parser 510, theentropy decoder 520, the inverse quantizer 530, the inverse transformer540, the intra predictor 550, the motion compensator 560, the deblockingunit 570, and the loop filtering unit 580 perform operations based oncoding units having a tree structure for each maximum coding unit.

Specifically, the intra prediction 550 and the motion compensator 560perform operations based on partitions and a prediction mode for each ofthe coding units having a tree structure, and the inverse transformer540 perform operations based on a size of a transformation unit for eachcoding unit.

The image decoder 500 may extract offset parameters of maximum codingunits from a bitstream, and adjust each restored pixel for each maximumcoding unit of the restored frame 595 by an offset value correspondingto a corresponding edge class or pixel value band by using offset typesand offset values included in the offset parameters.

FIG. 13 is a diagram illustrating deeper coding units according todepths, and partitions, according to an exemplary embodiment.

The video encoding apparatus 100 and the video decoding apparatus 200use hierarchical coding units to consider characteristics of an image. Amaximum height, a maximum width, and a maximum depth of coding units maybe adaptively determined according to the characteristics of the image,or may be differently set by a user. Sizes of deeper coding unitsaccording to depths may be determined according to the predeterminedmaximum size of the coding unit.

In a hierarchical structure 600 of coding units, according to anexemplary embodiment, the maximum height and the maximum width of thecoding units are each 64, and the maximum depth is 4. Since a depthdeepens along a vertical axis of the hierarchical structure 600, aheight and a width of the deeper coding unit are each split. Also, aprediction unit and partitions, which are bases for prediction encodingof each deeper coding unit, are shown along a horizontal axis of thehierarchical structure 600.

In other words, a coding unit 610 is a maximum coding unit in thehierarchical structure 600, wherein a depth is 0 and a size, i.e., aheight by width, is 64×64. The depth deepens along the vertical axis,and a coding unit 620 having a size of 32×32 and a depth of 1, a codingunit 630 having a size of 16×16 and a depth of 2, a coding unit 640having a size of 8×8 and a depth of 3, and a coding unit 650 having asize of 4×4 and a depth of 4 exist. The coding unit 650 having the sizeof 4×4 and the depth of 4 is a minimum coding unit.

The prediction unit and the partitions of a coding unit are arrangedalong the horizontal axis according to each depth. In other words, ifthe coding unit 610 having the size of 64×64 and the depth of 0 is aprediction unit, the prediction unit may be split into partitionsinclude in the encoding unit 610, i.e. a partition 610 having a size of64×64, partitions 612 having the size of 64×32, partitions 614 havingthe size of 32×64, or partitions 616 having the size of 32×32.

Similarly, a prediction unit of the coding unit 620 having the size of32×32 and the depth of 1 may be split into partitions included in thecoding unit 620, i.e. a partition 620 having a size of 32×32, partitions622 having a size of 32×16, partitions 624 having a size of 16×32, andpartitions 626 having a size of 16×16.

Similarly, a prediction unit of the coding unit 630 having the size of16×16 and the depth of 2 may be split into partitions included in thecoding unit 630, i.e. a partition having a size of 16×16 included in thecoding unit 630, partitions 632 having a size of 16×8, partitions 634having a size of 8×16, and partitions 636 having a size of 8×8.

Similarly, a prediction unit of the coding unit 640 having the size of8×8 and the depth of 3 may be split into partitions included in thecoding unit 640, i.e. a partition having a size of 8×8 included in thecoding unit 640, partitions 642 having a size of 8×4, partitions 644having a size of 4×8, and partitions 646 having a size of 4×4.

The coding unit 650 having the size of 4×4 and the depth of 4 is theminimum coding unit and a coding unit of the lowermost depth. Aprediction unit of the coding unit 650 is only assigned to a partitionhaving a size of 4×4.

To determine the at least one coded depth of the coding unitsconstituting the maximum coding unit 610, the coding unit determiner 120of the video encoding apparatus 100 performs encoding for coding unitscorresponding to each depth included in the maximum coding unit 610.

A number of deeper coding units according to depths including data inthe same range and the same size increases as the depth deepens. Forexample, four coding units corresponding to a depth of 2 are required tocover data that is included in one coding unit corresponding to a depthof 1. Accordingly, to compare encoding results of the same dataaccording to depths, the coding unit corresponding to the depth of 1 andfour coding units corresponding to the depth of 2 are each encoded.

To perform encoding for a current depth from among the depths, a leastencoding error may be selected for the current depth by performingencoding for each prediction unit in the coding units corresponding tothe current depth, along the horizontal axis of the hierarchicalstructure 600. Alternatively, the minimum encoding error may be searchedfor by comparing the least encoding errors according to depths, byperforming encoding for each depth as the depth deepens along thevertical axis of the hierarchical structure 600. A depth and a partitionhaving the minimum encoding error in the coding unit 610 may be selectedas the coded depth and a partition type of the coding unit 610.

FIG. 14 is a diagram for describing a relationship between a coding unit710 and transformation units 720, according to an exemplary embodiment.

The video encoding apparatus 100 or 200 encodes or decodes an imageaccording to coding units having sizes smaller than or equal to amaximum coding unit for each maximum coding unit. Sizes oftransformation units for transformation during encoding may be selectedbased on data units that are not larger than a corresponding codingunit.

For example, in the video encoding apparatus 100 or 200, if a size ofthe coding unit 710 is 64×64, transformation may be performed by usingthe transformation units 720 having a size of 32×32.

Also, data of the coding unit 710 having the size of 64×64 may beencoded by performing the transformation on each of the transformationunits having the size of 32×32, 16×16, 8×8, and 4×4, which are smallerthan 64×64, and then a transformation unit having the least coding errormay be selected.

FIG. 15 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to an exemplary embodiment.

The output unit 130 of the video encoding apparatus 100 may encode andtransmit information 800 about a partition type, information 810 about aprediction mode, and information 820 about a size of a transformationunit for each coding unit corresponding to a coded depth, as informationabout an encoding mode.

The information 800 indicates information about a shape of a partitionobtained by splitting a prediction unit of a current coding unit,wherein the partition is a data unit for prediction encoding the currentcoding unit. For example, a current coding unit CU_0 having a size of2N×2N may be split into any one of a partition 802 having a size of2N×2N, a partition 804 having a size of 2N×N, a partition 806 having asize of N×2N, and a partition 808 having a size of N×N. Here, theinformation 800 about a partition type is set to indicate one of thepartition 804 having a size of 2N×N, the partition 806 having a size ofN×2N, and the partition 808 having a size of N×N

The information 810 indicates a prediction mode of each partition. Forexample, the information 810 may indicate a mode of prediction encodingperformed on a partition indicated by the information 800, i.e., anintra mode 812, an inter mode 814, or a skip mode 816.

The information 820 indicates a transformation unit to be based on whentransformation is performed on a current coding unit. For example, thetransformation unit may be a first intra transformation unit 822, asecond intra transformation unit 824, a first inter transformation unit826, or a second inter transformation unit 828.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information 800, 810, and820 for decoding, according to each deeper coding unit

FIG. 16 is a diagram of deeper coding units according to depths,according to an exemplary embodiment.

Split information may be used to indicate a change of a depth. The spiltinformation indicates whether a coding unit of a current depth is splitinto coding units of a lower depth.

A prediction unit 910 for prediction encoding a coding unit 900 having adepth of 0 and a size of 2N_0×2N_0 may include partitions of a partitiontype 912 having a size of 2N_0×2N_0, a partition type 914 having a sizeof 2N_0×N_0, a partition type 916 having a size of N_0×2N_0, and apartition type 918 having a size of N_0×N_0. FIG. 16 only illustratesthe partition types 912 through 918 which are obtained by symmetricallysplitting the prediction unit 910, but a partition type is not limitedthereto, and the partitions of the prediction unit 910 may includeasymmetrical partitions, partitions having a predetermined shape, andpartitions having a geometrical shape.

Prediction encoding is repeatedly performed on one partition having asize of 2N_0×2N_0, two partitions having a size of 2N_0×N_0, twopartitions having a size of N_0×2N_0, and four partitions having a sizeof N_0×N_0, according to each partition type. The prediction encoding inan intra mode and an inter mode may be performed on the partitionshaving the sizes of 2N_0×2N_0, N_0×2N_0, 2N_0×N_0, and N_0×N_0. Theprediction encoding in a skip mode is performed only on the partitionhaving the size of 2N_0×2N_0.

Errors of encoding including the prediction encoding in the partitiontypes 912 through 918 are compared, and the least encoding error isdetermined among the partition types. If an encoding error is smallestin one of the partition types 912 through 916, the prediction unit 910may not be split into a lower depth.

If the encoding error is the smallest in the partition type 918, a depthis changed from 0 to 1 to split the partition type 918 in operation 920,and encoding is repeatedly performed on coding units 930 having a depthof 2 and a size of N_0×N_0 to search for a minimum encoding error.

A prediction unit 940 for prediction encoding the coding unit 930 havinga depth of 1 and a size of 2N_1×2N_1 (=N_0×N_0) may include partitionsof a partition type 942 having a size of 2N_1×2N_1, a partition type 944having a size of 2N_1×N_1, a partition type 946 having a size ofN_1×2N_1, and a partition type 948 having a size of N_1×N_1.

If an encoding error is the smallest in the partition type 948, a depthis changed from 1 to 2 to split the partition type 948 in operation 950,and encoding is repeatedly performed on coding units 960, which have adepth of 2 and a size of N_2×N_2 to search for a minimum encoding error.

When a maximum depth is d, split operation according to each depth maybe performed up to when a depth becomes d−1, and split information maybe encoded as up to when a depth is one of 0 to d−2. In other words,when encoding is performed up to when the depth is d−1 after a codingunit corresponding to a depth of d−2 is split in operation 970, aprediction unit 990 for prediction encoding a coding unit 980 having adepth of d−1 and a size of 2N_(d−1)×2N_(d−1) may include partitions of apartition type 992 having a size of 2N_(d−1)×2N_(d−1), a partition type994 having a size of 2N_(d−1)×N_(d−1), a partition type 996 having asize of N_(d−1)×2N_(d−1), and a partition type 998 having a size ofN_(d−1)×N_(d−1).

Prediction encoding may be repeatedly performed on one partition havinga size of 2N_(d−1)×2N_(d−1), two partitions having a size of2N_(d−1)×N_(d−1), two partitions having a size of N_(d−1)×2N_(d−1), fourpartitions having a size of N_(d−1)×N_(d−1) from among the partitiontypes 992 through 998 to search for a partition type having a minimumencoding error.

Even when the partition type 998 has the minimum encoding error, since amaximum depth is d, a coding unit CU_(d−1) having a depth of d−1 is nolonger split to a lower depth, and a coded depth for the coding unitsconstituting a current maximum coding unit 900 is determined to be d−1and a partition type of the current maximum coding unit 900 may bedetermined to be N_(d−1)×N_(d−1). Also, since the maximum depth is d anda minimum coding unit 980 having a lowermost depth of d−1 is no longersplit to a lower depth, split information for the minimum coding unit980 is not set.

A data unit 999 may be a ‘minimum unit’ for the current maximum codingunit. A minimum unit according to an exemplary embodiment may be arectangular data unit obtained by splitting a minimum coding unit 980 by4. By performing the encoding repeatedly, the video encoding apparatus100 may select a depth having the least encoding error by comparingencoding errors according to depths of the coding unit 900 to determinea coded depth, and set a corresponding partition type and a predictionmode as an encoding mode of the coded depth.

As such, the minimum encoding errors according to depths are compared inall of the depths of 1 through d, and a depth having the least encodingerror may be determined as a coded depth. The coded depth, the partitiontype of the prediction unit, and the prediction mode may be encoded andtransmitted as information about an encoding mode. Also, since a codingunit is split from a depth of 0 to a coded depth, only split informationof the coded depth is set to 0, and split information of depthsexcluding the coded depth is set to 1.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information about thecoded depth and the prediction unit of the coding unit 900 to decode thepartition 912. The video decoding apparatus 200 may determine a depth,in which split information is 0, as a coded depth by using splitinformation according to depths, and use information about an encodingmode of the corresponding depth for decoding.

FIGS. 17 through 19 are diagrams for describing a relationship betweencoding units 1010, prediction units 1060, and transformation units 1070,according to an exemplary embodiment.

The coding units 1010 are coding units having a tree structure,corresponding to coded depths determined by the video encoding apparatus100, in a maximum coding unit. The prediction units 1060 are partitionsof prediction units of each of the coding units 1010, and thetransformation units 1070 are transformation units of each of the codingunits 1010.

When a depth of a maximum coding unit is 0 in the coding units 1010,depths of coding units 1012 and 1054 are 1, depths of coding units 1014,1016, 1018, 1028, 1050, and 1052 are 2, depths of coding units 1020,1022, 1024, 1026, 1030, 1032, and 1048 are 3, and depths of coding units1040, 1042, 1044, and 1046 are 4.

In the prediction units 1060, some encoding units 1014, 1016, 1022,1032, 1048, 1050, 1052, and 1054 are obtained by splitting the codingunits in the encoding units 1010. In other words, partition types in thecoding units 1014, 1022, 1050, and 1054 have a size of 2N×N, partitiontypes in the coding units 1016, 1048, and 1052 have a size of N×2N, anda partition type of the coding unit 1032 has a size of N×N. Predictionunits and partitions of the coding units 1010 are smaller than or equalto each coding unit.

Transformation or inverse transformation is performed on image data ofthe coding unit 1052 in the transformation units 1070 in a data unitthat is smaller than the coding unit 1052. Also, the coding units 1014,1016, 1022, 1032, 1048, 1050, and 1052 in the transformation units 1070are different from those in the prediction units 1060 in terms of sizesand shapes. In other words, the video encoding and decoding apparatuses100 and 200 may perform intra prediction, motion estimation, motioncompensation, transformation, and inverse transformation individually ona data unit in the same coding unit.

Accordingly, encoding is recursively performed on each of coding unitshaving a hierarchical structure in each region of a maximum coding unitto determine an optimum coding unit, and thus coding units having arecursive tree structure may be obtained. Encoding information mayinclude split information about a coding unit, information about apartition type, information about a prediction mode, and informationabout a size of a transformation unit. Table 1 shows the encodinginformation that may be set by the video encoding and decodingapparatuses 100 and 200.

TABLE 1 Split Information 0 (Encoding on Coding Unit having Size of 2N ×2N and Current Depth of d) Size of Transformation Unit Split SplitPartition Type Information 0 Information 1 Symmetrical Asymmetrical ofof Prediction Partition Partition Transformation Transformation SplitMode Type Type Unit Unit Information 1 Intra 2N × 2N 2N × nU 2N × 2N N ×N Repeatedly Inter 2N × N  2N × nD (Symmetrical Encode Skip  N × 2N nL ×2N Type) Coding Units (Only N × N nR × 2N N/2 × N/2 having Lower 2N ×2N) (Asymmetrical Depth of d + 1 Type)

The output unit 130 of the video encoding apparatus 100 may output theencoding information about the coding units having a tree structure, andthe image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract the encoding information about thecoding units having a tree structure from a received bitstream.

Split information indicates whether a current coding unit is split intocoding units of a lower depth. If split information of a current depth dis 0, a depth, in which a current coding unit is no longer split into alower depth, is a coded depth, and thus information about a partitiontype, prediction mode, and a size of a transformation unit may bedefined for the coded depth. If the current coding unit is further splitaccording to the split information, encoding is independently performedon four split coding units of a lower depth.

A prediction mode may be one of an intra mode, an inter mode, and a skipmode. The intra mode and the inter mode may be defined in all partitiontypes, and the skip mode is defined only in a partition type having asize of 2N×2N.

The information about the partition type may indicate symmetricalpartition types having sizes of 2N×2N, 2N×N, N×2N, and N×N, which areobtained by symmetrically splitting a height or a width of a predictionunit, and asymmetrical partition types having sizes of 2N×nU, 2N×nD,nL×2N, and nR×2N, which are obtained by asymmetrically splitting theheight or width of the prediction unit. The asymmetrical partition typeshaving the sizes of 2N×nU and 2N×nD may be respectively obtained bysplitting the height of the prediction unit in 1:3 and 3:1, and theasymmetrical partition types having the sizes of nL×2N and nR×2N may berespectively obtained by splitting the width of the prediction unit in1:3 and 3:1

The size of the transformation unit may be set to be two types in theintra mode and two types in the inter mode. In other words, if splitinformation of the transformation unit is 0, the size of thetransformation unit may be 2N×2N, which is the size of the currentcoding unit. If split information of the transformation unit is 1, thetransformation units may be obtained by splitting the current codingunit. Also, if a partition type of the current coding unit having thesize of 2N×2N is a symmetrical partition type, a size of atransformation unit may be N×N, and if the partition type of the currentcoding unit is an asymmetrical partition type, the size of thetransformation unit may be N/2×N/2.

The encoding information about coding units having a tree structure mayinclude at least one of a coding unit corresponding to a coded depth, aprediction unit, and a minimum unit. The coding unit corresponding tothe coded depth may include at least one of a prediction unit and aminimum unit containing the same encoding information.

Accordingly, it is determined whether adjacent data units are includedin the same coding unit corresponding to the coded depth by comparingencoding information of the adjacent data units. Also, a correspondingcoding unit corresponding to a coded depth is determined by usingencoding information of a data unit, and thus a distribution of codeddepths in a maximum coding unit may be determined.

Accordingly, if a current coding unit is predicted based on encodinginformation of adjacent data units, encoding information of data unitsin deeper coding units adjacent to the current coding unit may bedirectly referred to and used.

Alternatively, if a current coding unit is predicted based on encodinginformation of adjacent data units, data units adjacent to the currentcoding unit are searched using encoded information of the data units,and the searched adjacent coding units may be referred for predictingthe current coding unit.

FIG. 20 is a diagram for describing a relationship between a codingunit, a prediction unit or a partition, and a transformation unit,according to encoding mode information of Table 1.

A maximum coding unit 1300 includes coding units 1302, 1304, 1306, 1312,1314, 1316, and 1318 of coded depths. Here, since the coding unit 1318is a coding unit of a coded depth, split information may be set to 0.Information about a partition type of the coding unit 1318 having a sizeof 2N×2N may be set to be one of a partition type 1322 having a size of2N×2N, a partition type 1324 having a size of 2N×N, a partition type1326 having a size of N×2N, a partition type 1328 having a size of N×N,a partition type 1332 having a size of 2N×nU, a partition type 1334having a size of 2N×nD, a partition type 1336 having a size of nL×2N,and a partition type 1338 having a size of nR×2N.

Split information (TU size flag) of a transformation unit is a kind oftransformation index. A size of the transformation unit corresponding tothe transformation index may change according to a prediction unit typeor a partition type of a coding unit.

When the partition type is set to be symmetrical, i.e. the partitiontype 1322, 1324, 1326, or 1328, a transformation unit 1342 having a sizeof 2N×2N is set if the split information (TU size flag) of atransformation unit is 0, and a transformation unit 1344 having a sizeof N×N is set if a TU size flag is 1.

When the partition type is set to be asymmetrical, i.e., the partitiontype 1332, 1334, 1336, or 1338, a transformation unit 1352 having a sizeof 2N×2N is set if a TU size flag is 0, and a transformation unit 1354having a size of N/2×N/2 is set if a TU size flag is 1.

Referring to FIG. 20, the TU size flag is a flag having a value or 0 or1, but the TU size flag is not limited to 1 bit, and a transformationunit may be hierarchically split having a tree structure while the TUsize flag increases from 0. The split information (TU size flag) of atransformation unit may be used as an exemplary embodiment of thetransformation index.

In this case, the size of a transformation unit that has been actuallyused may be expressed by using a TU size flag of a transformation unit,according to an exemplary embodiment, together with a maximum size andminimum size of the transformation unit. According to an exemplaryembodiment, the video encoding apparatus 100 is capable of encodingmaximum transformation unit size information, minimum transformationunit size information, and a maximum TU size flag. The result ofencoding the maximum transformation unit size information, the minimumtransformation unit size information, and the maximum TU size flag maybe inserted into an SPS. According to an exemplary embodiment, the videodecoding apparatus 200 may decode video by using the maximumtransformation unit size information, the minimum transformation unitsize information, and the maximum TU size flag.

For example, if the size of a current coding unit is 64×64 and a maximumtransformation unit size is 32×32, then the size of a transformationunit may be 32×32 when a TU size flag is 0, may be 16×16 when the TUsize flag is 1, and may be 8×8 when the TU size flag is 2.

As another example, if the size of the current coding unit is 32×32 anda minimum transformation unit size is 32×32, then the size of thetransformation unit may be 32×32 when the TU size flag is 0. Here, theTU size flag cannot be set to a value other than 0, since the size ofthe transformation unit cannot be less than 32×32.

As another example, if the size of the current coding unit is 64×64 anda maximum TU size flag is 1, then the TU size flag may be 0 or 1. Here,the TU size flag cannot be set to a value other than 0 or 1.

Thus, if it is defined that the maximum TU size flag is‘MaxTransformSizelndex’, a minimum transformation unit size is‘MinTransformSize’, and a transformation unit size is ‘RootTuSize’ whenthe TU size flag is 0, then a current minimum transformation unit size‘CurrMinTuSize’ that can be determined in a current coding unit, may bedefined by Equation (1):CurrMinTuSize=max(MinTransformSize,RootTuSize/(2{circumflex over( )}MaxTransformSizeIndex))  (1)

Compared to the current minimum transformation unit size ‘CurrMinTuSize’that can be determined in the current coding unit, a transformation unitsize ‘RootTuSize’ when the TU size flag is 0 may denote a maximumtransformation unit size that can be selected in the system. In Equation(1), ‘RootTuSize/(2{circumflex over ( )}MaxTransformSizelndex)’ denotesa transformation unit size when the transformation unit size‘RootTuSize’, when the TU size flag is 0, is split a number of timescorresponding to the maximum TU size flag, and ‘MinTransformSize’denotes a minimum transformation size. Thus, a smaller value from among‘RootTuSize/(2{circumflex over ( )}MaxTransformSizelndex)’ and‘MinTransformSize’ may be the current minimum transformation unit size‘CurrMinTuSize’ that can be determined in the current coding unit.

According to an exemplary embodiment, the maximum transformation unitsize RootTuSize may vary according to the type of a prediction mode.

For example, if a current prediction mode is an inter mode, then‘RootTuSize’ may be determined by using Equation (2) below. In Equation(2), ‘MaxTransformSize’ denotes a maximum transformation unit size, and‘PUSize’ denotes a current prediction unit size.RootTuSize=min(MaxTransformSize,PUSize)  (2)

That is, if the current prediction mode is the inter mode, thetransformation unit size ‘RootTuSize’ when the TU size flag is 0, may bea smaller value from among the maximum transformation unit size and thecurrent prediction unit size.

If a prediction mode of a current partition unit is an intra mode,‘RootTuSize’ may be determined by using Equation (3) below. In Equation(3), ‘PartitionSize’ denotes the size of the current partition unit.RootTuSize=min(MaxTransformSize,PartitionSize)  (3)

That is, if the current prediction mode is the intra mode, thetransformation unit size ‘RootTuSize’ when the TU size flag is 0 may bea smaller value from among the maximum transformation unit size and thesize of the current partition unit.

However, the current maximum transformation unit size ‘RootTuSize’ thatvaries according to the type of a prediction mode in a partition unit isjust an example and the present invention is not limited thereto.

According to the video encoding method based on coding units of the treestructure described above with reference to FIGS. 8 through 20, imagedata of a spatial domain may be encoded for each coding unit of the treestructure, and image data of the spatial domain may be restored whendecoding is performed for each maximum coding unit according to thevideo decoding method based on coding units of the tree structure, andthus video that includes a picture and a picture sequence may berestored. The restored video may be reproduced by a reproductionapparatus, stored in a storage medium, or transmitted over a network.

Also, an offset parameter may be encoded and transmitted or received anddecoded for each picture, each slice, or each maximum coding unit, orfor each coding unit of the tree structure, or a prediction unit of acoding unit, or a transformation unit of the coding unit. For example,restored pixel values of maximum coding units are adjusted by usingrestored offset values based on an offset parameter received for eachmaximum coding unit, and thus a restored block having a minimum errorwith respect to an original block may be restored.

The exemplary embodiments can be written as computer programs and can beimplemented in general-use digital computers that execute the programsusing a computer readable recording medium. Examples of the computerreadable recording medium include magnetic storage media (e.g., ROM,floppy disks, hard disks, etc.) and optical recording media (e.g.,CD-ROMs, or DVDs).

While this invention has been particularly shown and described withreference to preferred embodiments thereof, it will be understood bythose of ordinary skill in the art that various changes in form anddetails may be made therein without departing from the spirit and scopeof the invention as defined by the appended claims. The preferredembodiments should be considered in descriptive sense only and not forpurposes of limitation. Therefore, the scope of the invention is definednot by the detailed description of the invention but by the appendedclaims, and all differences within the scope will be construed as beingincluded in the present invention.

What is claimed is:
 1. A video decoding method comprising: parsing, from a bitstream, offset merge information indicating whether an offset parameter of a current block is determined according to an offset parameter of a neighboring block; when the offset merge information indicates that the offset parameter of the current block is determined according to the offset parameter of the neighboring block, determining the offset parameter of the current block using the offset parameter of the neighboring block; and when the offset merge information indicates that the offset parameter of the current block is not determined according to the offset parameter of the neighboring block, obtaining, from the bitstream, offset type information of the current block and absolute values of a plurality of offset values of the current block; and compensating for samples of the current block by using the absolute values of the plurality of offset values, wherein, the obtaining, from the bitstream, offset type information of the current block and absolute values of a plurality of offset values of the current block comprises: when the offset type information indicates one of a band offset type and an edge offset type, obtaining the absolute values of the plurality of offset values from the bitstream; and when the absolute values of the plurality of offset values are not zero, obtaining sign bits of the plurality of offset values from the bitstream, wherein the offset type information of the current block indicates one of the band offset type, the edge offset type and whether the plurality of offset values are applied to the current block, and the neighboring block is one of a left block and an upper block adjacent to the current block.
 2. The video decoding method of claim 1, wherein when the offset merge information indicates that the offset parameter of the current block is determined according to the offset parameter of the neighboring block, the offset parameter of the current block is not parsed from the bitstream. 